Not Teleporting

Hello! I made a cash system once you touch it, you teleport to the spawnpoint however, it doesn’t teleport you, it just grants you cash.

local folder = script.Parent:GetChildren()
local SpawnFolder = workspace.MainSpawns:GetChildren()
local GetMoney = false

for i, Money in pairs(folder) do
	if Money:IsA("Part") then
		Money.Touched:Connect(function(hit)
			local hum = hit.Parent:FindFirstChild("Humanoid")
			
			if hum then
				local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
				if GetMoney == false then
					GetMoney = true
					plr.leaderstats:WaitForChild("💰 Money").Value += Money.Money.Value
					hit.Parent:WaitForChild("HumanoidRootPart").CFrame = SpawnFolder[math.random(#SpawnFolder)].CFrame
					wait(1.3)
					GetMoney = false
				end
			end
			
		end)
		
	end
	
end
1 Like

Any error messages in the output window?

1 Like

No it just grants the cash, no errors

I opened a new baseplate. Created two folders with the spawns and parts. Pasted in your code and it works fine.

Not sure why it is not working for you.

Oh, I’ve played test it but it just grants me cash but doesn’t teleport, this is annoying. I’ve played test it several times.

1 Like

Baseplate.rbxl (54.9 KB)

Doesn’t still. Something is wrong

To
SpawnFolder[math.random(1, #SpawnFolder)].CFrame

1 Like

The file I posted works on my machine.

Maybe restart your computer.

It’s not that. I have the exact same teleporter and that works fine, it’s just this one that doesn’t work. What if I teleport another body part? What body part should I teleport?

Still doesn’t work. What if I teleport another body part? What body part should I teleport?

Im not understanding the problem any longer.

The code you posted works fine. Check the file I uploaded.

Try using on the line below the cash granting:

hit.Parent:WaitForChild("HumanoidRootPart").CFrame = SpawnFolder[math.random(#SpawnFolder:GetChildren())].CFrame"