This script is supposed to spawn a player at a checkpoint when they spawn or respawn but it is not working. Why is this?
char.HumanoidRootPart:PivtoTo(worksapce.Checkpoints[plr.leaderstats.Checkpoint.Value])
It did not work also alot of things are misspelled.
Its misspelled because I just typed it fast into the chat, its not from the actual studio or anyting with type correction.
Also… can you put some prints or breakpoints in that code to see if the execution is even reaching the inner areas?
im not a master coder but i think you could use a spawn point and adjust its properties
Anything in output?
heresyour30
No it’s clear.
“Insert characters”
Put an else and print after each of those FindFirstChilds to figure out which one is bullying you.
or just put a print at the beginning of all of them thats smarter
You need to add a wait after the last if statement.
When I tested with your code it had the exact same problem not going to the Part.
Once the Roblox character loads in-game, it is moved to 0, 0, 0 or to a spawn location. To override this, you can add a slight delay using RunService.Stepped
local Checkpoints = workspace:WaitForChild("Checkpoints")
local RunService = game:GetService("RunService")
game:GetService("Players").PlayerAdded:Connect(function(player: Player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local checkpoint = Instance.new("StringValue")
checkpoint.Name = "Checkpoint"
checkpoint.Value = "Start"
checkpoint.Parent = leaderstats
player.CharacterAdded:Connect(function(character)
if checkpoint.Value ~= "" and Checkpoints:FindFirstChild(checkpoint.Value) then
RunService.Stepped:Wait()
character:WaitForChild("HumanoidRootPart").CFrame = Checkpoints:FindFirstChild(checkpoint.Value).CFrame + Vector3.new(0, 3, 0)
end
end)
end)
Found the solution. Thank you all for your help.