I think I have a problem scripting between the client and the server.
I have a script in a part and when you touch the part, it enables a gui.
Inside this gui are pictures of places and when you click on one, there is a local script that teleports the player and disables the gui.
The problem is that it only works once and then it won’t work again.
I think I am turning it on with the server and then off on the client and so I think I need to make some kind of remote event, but I’m not sure how.
Here are my scripts (I also tried doing visible instead of enabled but still wouldn’t work.)
script
debounce = false
script.Parent.Touched:Connect(function(hit)
local char = hit.Parent
local hum = char:FindFirstChild("Humanoid")
local player = game.Players:GetPlayerFromCharacter(char)
if hum ~= nil and player ~= nil and debounce == false then
player.PlayerGui.Teleport.Enabled = true
debounce = true
wait(2)
debounce = false
end
end)
local script
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
if player and player.leaderstats.Power.Value >= 1000 then
player.Character.HumanoidRootPart.CFrame = game.Workspace.Jungle.Jungle1.JTeleport.CFrame
player.PlayerGui.Teleport.Enabled = false
else
--warn not enough power to teleport
end
end)