for _,v in pairs(Players:GetPlayers()) do
local Char = v.Character or v.CharacterAdded:Wait()
local HMR = Char:WaitForChild("HumanoidRootPart")
HMR.Anchored = true
Char:SetPrimaryPartCFrame(CFrame.new(MapDictionary[clone.Name]["spawnLoc"])) -- This part works as intended
HMR.Anchored = false
v.CharacterAdded:Connect(function(Char)
local HMR = Char:WaitForChild("HumanoidRootPart")
HMR.Anchored = true
Char:SetPrimaryPartCFrame(CFrame.new(MapDictionary[clone.Name]["spawnLoc"])) -- This part doesn't the player just drops from 0, 0, 0
HMR.Anchored = false
end)
end
So bassicaly when the player dies and respawns instead of going to where I ask it to, It drops from the sky at vector(0, 0, 0)
I’m not sure how I can use the if I’m using SetPrimaryPartCFrame but I can try a diffrent method
I have made some small changes
for _,v in pairs(Players:GetPlayers()) do
local Char = v.Character or v.CharacterAdded:Wait()
local HMR = Char:WaitForChild("HumanoidRootPart")
HMR.Anchored = true
Char:SetPrimaryPartCFrame(CFrame.new(MapDictionary[clone.Name]["spawnLoc"]))
HMR.Anchored = false
v.CharacterAdded:Connect(function(Char2)
local HMR = Char2:WaitForChild("HumanoidRootPart")
HMR.Anchored = true
Char2.PrimaryPart = HMR
Char2:SetPrimaryPartCFrame(CFrame.new(MapDictionary[clone.Name]["spawnLoc"]))
HMR.Anchored = false
end)
end
and my MapDictionary[clone.Name]["spawnLoc] is a vector3 value so I’m not sure how to do HMR.CFrame
Nvm I missunderstood. Just get the checkpoint part and get its CFrame. Something like this: Char2:SetPrimaryPartCFrame(checkpoint.CFrame)
Also, you don’t need to set the char’s PrimaryPart to HumanoidRootPart as it always is.