My friend and I are making a game that has an obby you get to from the lobby for people waiting. The problem is that it won't teleport them back to the lobby and reward them. [IMPORTANT] It works in ROBLOX Studio's "Play". It is a script as a child of a part directly in workspace. I have tried it under a local script in the same location but it still won't work when you play outside of studio.
The script is...
--Made by CamScripted
function onTouched(part)
local shillings = game.Players.LocalPlayer.leaderstats.Shillings
local c = part.Parent
if c ~= nil then
c.Torso.CFrame = CFrame.new(Vector3.new(19.808, 3.285, 8.748))
end
wait(.1)
shillings.Value = shillings.Value + 10
wait(1)
end
script.Parent.Touched:connect(onTouched)

2 comments
Thanks for the help ;3
If I put it under some part of the character it wouldn't connect to the end of the obby. How do I put it there and it still register the part they are supposed to touch?