What do you want to achieve?
When the player dies or joins the game, I need their position to be set to the position of a part in the workspace.
What is the issue?
Their position is not being set, there are no errors being outputted.
What solutions have you tried so far?
I can’t find exactly what I’m looking for, if there are any topics already on this and I’ve just not been able to find them then it would be much appreciated if you could link it
This is what I’ve tried so far. ServerData[Player].leaderstats.Level is what stage the player is currently on and it’s searching a folder the name to move the HRP to.
This is using Player.CharacterAdded event by the way.
local HRP = Character:WaitForChild("HumanoidRootPart")
HRP.CFrame = game.Workspace.Checkpoints:WaitForChild(tostring(ServerData[Player].leaderstats.Level)).CFrame
Sorry if this is really simple and has already been asked, I’ve tried to look for some topics relating to this.
Any help is much appreciated!
local part = game.Workspace.part -- or wherever the part is
for i, v in pairs (game.Players:GetPlayers()) do
v.Character.HumanoidRootPart.Position = Part.Position
There isn’t much more of use to show. The Level is stored as an Integer, and the part in Checkpoints that it’s looking for is just a part. What do you need to see?
In this case you want to use SetPrimaryPartCFrame on the player.Character. CFrame.new() will be the position of where ever you want the character to go.
try setting the respawn point and save it instead of setting and saving your position Player.RespawnLocation (roblox.com) and use data stores to save your respawn location
This gives me an error because I’m trying to get the position of the Part I just found. If I put the .Position at the end it’s not getting the Position of anything.
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local hrp = character:WaitForChild("HumanoidRootPart")
local leaderstats = player:WaitForChild("leaderstats")
local level = leaderstats:WaitForChild("Level")
for i , descendants in pairs(game.Workspace.Checkpoints:GetDescendants()) do
if level.Value == descendants.Name then
hrp.CFrame = descendants.CFrame + Vector3.new(0, 6, 0)
end
end
end)
end)