What I’m Trying To Achieve
I have 4 walls surrounding my spawn area like so:
I want to make it so that when the player touches one of these walls, they will instantly be teleported back to that center circle there.
These are where the walls are:
And this is where the circle is:
My Issue
I am having trouble executing what I want to do.
I have the script as a Local Script inside StarterPlayerScripts.
Should it be somewhere else?
This is the code that I have:
local bar = game.Workspace.NewObby.SpawnArea["Spawn Walls"]:GetChildren()
local spawnPad = game.Workspace.NewObby.SpawnArea["Spawn Pad"]["Pad_Piece Top"]
bar.Touched:Connect(function(hit)
local beenHit = hit.Parent:FindFirstChild('HumanoidRootPart')
if beenHit then
beenHit.CFrame = spawnPad.CFrame + Vector3.new(0, 5, 0)
end
end)