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)

3 comments
PlayerGui cannot be accessed from the server.
Thanks. So what would be a workaround to that?
Place the sound elsewhere.