I'm new to scripting, and I'm probably overlooking something simple here. I'm making a brick that when touched teleports you to a new area. This script works perfectly fine in a local server, but not in a team test or actual server. I do know that in an actual server the client is separated from the server, but I'd like to have an explanation on why this doesn't work. Any help is greatly appreciated.
function onTouched(hit) local plr = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent) if plr then plr.PlayerGui.Pop:Play() plr.Character.Torso.CFrame = CFrame.new(-9999, 0 , -9999) end end script.Parent.Touched:Connect(onTouched)
Put a RemoteEvent in ReplicatedStorage and remplace line 4 for that
game.ReplicatedStorage.RemoteEvent:FireClient(Player)
add a LocalScript in StarterGui with ur sound and write this.
local debounce = true game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function() if debounce then debounce = false script.Parent.Pop:Play() wait(1) debounce = true end end)