I made the script that when it touches the Model, it teleports back to the parts named "Spawn1","Spawn2" until "Spawn16" so there are 16 parts that is parented by "Spawn".The "Spawn" is parented by "Mega Challenge". But the script says this "Spawn1 is not a valid member of Model" "Spawn8 is not a valid member of Model" "Spawn5 is not a valid member of Model" It shows when I touched the Model named "Hammer" parented by "TrapPlatformHammer".The "TrapPlatformHammer" is parented by "Mega Challenge" too. Can you help me? I'm confused This is the script.
script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild('Humanoid') then local num = math.random(1,16) hit.Parent.Head.CFrame = CFrame.new(game.Workspace.MegaChallenge.Spawns("Spawn"..num).Position) end end)
game.Workspace.MegaChallenge.Spawns("Spawn"..num).Position
, but ["Spawn"..num].Position
. script.Parent.Touched:connect(function(hit)
if hit.Parent ~= nil then local player = game.Players:WaitForChild(hit.Parent.Name)
local num = math.random(1,16)
player.Character:MoveTo(game.Workspace.MegaChallenge.Spawns["Spawn"..num].Position)
end
end)