So I’m trying to make the player teleport in and out a box as I’m working on a queue system, this and that system are seperate though.
Though the teleporting inside works, the button is not working to have the player teleport out.
I’ve tried fixing the paths and trying to search for any fixes, although it could be the facts that it is seperate from the script that handles queueing. Again, I’m super new to scripting.
I’ll answer any questions to fix this issue
local insidepart = script.Parent.playerin
local outsidepart = script.Parent.playerout
local player = game.Players.LocalPlayer
local prompt = script.Parent.Overhead.ProximityPrompt
local leavebutton = game.StarterGui.Queue.LeaveButton
-- Join Button
prompt.Triggered:Connect(function(player)
player.Character.HumanoidRootPart.CFrame = insidepart.CFrame
end)
-- Leave button
leavebutton.MouseButton1Click:Connect(function(player)
player.Character.HumanoidRootPart.CFrame = outsidepart.CFrame
end)
The first line where you connect to the MouseButton1Click Event: The MouseButton1Click event has no parameter so you are assigned nil to the player variable that you assigned above. So change you code to this and hopefully it will work.
local insidepart = script.Parent.playerin
local outsidepart = script.Parent.playerout
local player = game.Players.LocalPlayer
local prompt = script.Parent.Overhead.ProximityPrompt
local leavebutton = game.StarterGui.Queue.LeaveButton
-- Join Button
prompt.Triggered:Connect(function(player)
player.Character.HumanoidRootPart.CFrame = insidepart.CFrame
end)
-- Leave button
leavebutton.MouseButton1Click:Connect(function()
player.Character.HumanoidRootPart.CFrame = outsidepart.CFrame
end)
In the video you see that when you click on the “Leave Queue” Button it disappears. Where did you script that? I mean, the click gets registered and the button’s Visibility is set to false, by which script is this made? Maybe a local script with Parent set to the GUI button?
I did notice this and although is isn’t what I wanted I came up with my own solution, instead of teleporting the player outside the box I made it so there’s a set location. Which did end up working.