I have test that but that doesnt work :
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
Character.PrimaryPart.CFrame = workspace.Part.CFrame
end)
end)
I have test that but that doesnt work :
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
Character.PrimaryPart.CFrame = workspace.Part.CFrame
end)
end)
I also had think about it but the chr variable should have waited for it to respawn right?
Yes it is not what you want ?
ignore this : eifjaz_çejfg_ç
to my conclusion u can just use the characteradded event after the .Died event?
By The way I had been already try it before creating this forum
The CharacterAdded function will be called whenever the players character is added, or when they respawn. So using the code by @FireStrykerAzul, that should work, but also modifying my local script code should work aswell.
local Player = game.Players.LocalPlayer
Player.CharacterAdded:Connect(function(Character)
Character:WaitForChild("HumanoidRootPart").CFrame = workspace.spawn.CFrame
end)
The only thing about this script is that upon joining the game, you will be teleported to the spawn locations CFrame, but if that is what you want, its a bonus.
As I have told you this works perfectly Character:WaitForChild("HumanoidRootPart").CFrame = workspace.spawn.CFrame
with other event but not with the died event
local Player = game.Players.LocalPlayer
Player.CharacterAdded:Connect(function(Character)
local hum = Character:WaitForChild("Humanoid")
hum.Died:Connect(function()
Player.CharacterAdded:Connect(function(char)
local root = char:WaitForChild("HumanoidRootPart")
root.CFrame = workspace.Part.CFrame
end)
end)
end)
Im sure this will do it
-- your part
local spawnPart = workspace.spawn
local function OnCharacter(character)
local humanoid = character:WaitForChild("Humanoid")
humanoid.Died:Connect(function()
-- add player height and brick height to spawn on top of the brick instead of in it
local playerHeight = humanoid.HipHeight + (character.PrimaryPart.Size.Y * 0.5)
local brickHeight = spawnPart.Size.Y * 0.5
local spawnHeight = playerHeight + brickHeight
-- move player
character:SetPrimaryPartCFrame(spawnPart.CFrame + Vector3.new(0, spawnHeight, 0))
end)
end
local function OnPlayer(player)
local character = player.Character
if character then
-- character already loaded
OnCharacter(character)
end
-- when characters load
player.CharacterAdded:Connect(OnCharacter)
end
-- capture players joining
game.Players.PlayerAdded:Connect(OnPlayer)
-- capture players not caught by the event
for _, player in game.Players:GetPlayers() do
task.spawn(OnPlayer, player)
end
Hey there! Sorry for the late response, but the following code should fix this.
You can either use
Players.PlayerAdded:Connect(function(player)
local chr = player.Character or player.CharacterAdded:Wait()
chr:WaitForChild("Humanoid").Died:Connect(function()
local pos = game.Workspace.spawn.Position
chr.HumanoidRootPart.CFrame = CFrame.new(pos.X, pos.Y, pos.Z or 0)
end)
end)
or just this:
Players.PlayerAdded:Connect(function(player)
local chr = player.Character or player.CharacterAdded:Wait()
chr:WaitForChild("Humanoid").Died:Connect(function()
chr.HumanoidRootPart.CFrame = game.Workspace.spawn.CFrame
end)
end)
Good luck!
thx for your help but I have already try this
I’m not sure if this is what you wanted but here you go, I connected it to a CharacterAdded event and added a wait because the CharacterAdded event runs a little bit early, earlier than the actual character parts.
local Players = game:GetService("Players")
local function CharSpawned(char)
wait()
char:WaitForChild("HumanoidRootPart").CFrame = workspace.Part.CFrame
end
Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(CharSpawned)
end)
You should use PivotTo to move the Character.
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(chr)
local Humanoid = chr:WaitForChild("Humanoid")
Humanoid.Died:Once(function()
chr:PivotTo(workspace.spawn.CFrame)
end)
end)
end)
Have you tried changing the HumanoidRootPart’s position? If that doesn’t work, make sure the character model’s PrimaryPart property is HumanoidRootPart, otherwise it won’t work.
Thanks for you help it worked
ignore this: minimum character bypass