I'm trying to create a simple teleportation. What I'm trying to do is make it like when you reach the end of the obby, you get points and then you teleport back to the brick. For some reason, it's not working and I don't know why. I'm attempting to teleport the HumanoidRootPart. (Also, the leaderstats value is not working but I'll post a separate question later.)
The descendants goes like this: game.Workspace.Folder.Part
workspace.ObbyStuff.GetPoints.Touched:Connect(function(hit) local brick = workspace.ObbyStuff.Teleporter local debounce = false if game.Players:GetPlayerFromCharacter(hit.Parent) then if not debounce then debounce = true local plr = game.Players[hit.Parent.Name] hit.Parent.HumanoidRootPart.CFrame = brick.CFrame plr.leaderstats.Points.Value = plr.leaderstats.Points.Value + 100 wait() debounce = false end end end)
I have no idea why it is not working, and I would like help to solve this issue. No errors at least from what I see. Any help is appreciated, because I am [Visible Confusion].
Try changing
hit.Parent.HumanoidRootPart.CFrame = brick.CFrame
to
hit.Parent.HumanoidRootPart.CFrame = brick.Position
Try replacing hit.Parent.HumanoidRootPart.CFrame = brick.CFrame
with
hit.Parent:SetPrimaryPartCFrame(brick.CFrame)