I have a teleporter system where when a player touches a part, they get put into an elevator, a countdown starts, and the first player to enter the elevator gets to set some different options like the map and difficulty. This all works properly if there is only one elevator, but when I duplicate the elevator and someone enters one, the gui gets updated on all of the elevators and when the player leaves the elevator it loops through all of the elevator’s exit locations and puts the player at the last one.
The server script and the surfaceGui are both descendants of the elevator model that I’m duplicating.
Here’s part of the script that changes the surfaceGui (which updates the Gui for all of the elevators for some reason):
local elevator = script.Parent
local surfaceGui = elevator.Entrance.SurfaceGui
local surfaceDifficulty = surfaceGui.Difficulty
local surfaceRoomAmount = surfaceGui.RoomAmount
optionsEvent.OnServerEvent:Connect(function(player, eventtype, value)
if eventtype == "updateDifficulty" then
difficulty = value
surfaceDifficulty.Text = "Difficulty: " .. tostring(difficulty)
surfaceDifficulty.Visible = true
elseif eventtype == "updateRoomAmount" then
roomAmount = value
surfaceRoomAmount.Text = "Room Amount: " .. tostring(roomAmount)
surfaceRoomAmount.Visible = true
end
end)
Here’s the part of the local script that fires that event:
lobbyGui.mapSelectionFrame.Buttons.nextButton.Activated:Connect(function()
if map ~= nil then
lobbyGuiEvent:FireServer("isReady")
lobbyGui.UIPageLayout:Next()
local difficulty = tonumber(difficultyText.Text)
optionsEvent:FireServer("updateDifficulty", difficulty)
local roomAmount = tonumber(roomAmoutText.Text)
optionsEvent:FireServer("updateRoomAmount", roomAmount)
else
lobbyGui.mapSelectionFrame.Title.TextColor = BrickColor.new("Really red")
task.wait(1)
lobbyGui.mapSelectionFrame.Title.TextColor = BrickColor.new("White")
end
end)
This essentially saves the settings that the host has chosen when they press the next button on the gui that pops up when they enter the elevator.
I’ve tried giving each elevator model and elevator serverscript unique names but that doesn’t do anything because they all reference script.Parent.
I also tried changing local elevator = script.Parent
to local elevator = game.Workspace.Castle.Elevators.Elevator1
which didn’t seem to change or fix anything.