Hello everyone, I have been working on a fun game which uses player teleportation to a map in-game. Unfortunately recently I have noticed that sometimes during testing, right after the player’s HumanoidRootPart CFrame has been moved to a spawnpoint in a map, the player dies. Sometimes it is a few seconds after teleportation. This has happened before, and at first I thought that it was because of a malicious script, since I do use free models sometimes, but I removed them and the problem still occurs. The only solution I found was to move over all of the stuff in my game to a new place. Please help! Thanks.
EDIT:
Bug was fixed. Setting CFrame teleports the player too fast and causes head dislocation. Use position if you are also experiencing this bug.
I haven’t ever experienced this just from setting the root part’s CFrame. Is there any other system in your game that affects the health of the player?
Is there anything that is removing the Weld from the Head to the Torso? That’ll kill your character.
Try showing us the script you are using to teleport, without it we really can’t help you.
for _, player in pairs(contestants) do
if player and player.Character and #spawns > 0 then
local torso = player.Character:FindFirstChild("HumanoidRootPart")
local humanoid = player.Character:FindFirstChild("Humanoid")
local spawnindex = math.random(1, #spawns)
local spawnx = spawns[spawnindex]
if spawnx and torso and humanoid then
humanoid.Health = 100
humanoid.WalkSpeed = 16
table.remove(spawns, spawnindex)
if torso and player and humanoid then
torso.CFrame = CFrame.new(spawn.Position + Vector3.new(0, 3, 0))
end
local matchtag = Instance.new("StringValue")
matchtag.Name = "MatchTag"
matchtag.Parent = player.Character
local backpack = player:FindFirstChild("Backpack")
if backpack then
if player == bloxxer then
event:FireClient(player, "Class", "Bloxxer")
local equippedpower = player:WaitForChild("EquippedPower")
if equippedpower then
if equippedpower.Value == "Ghost" then
event:FireClient(player, "Ghost")
elseif equippedpower.Value == "Sprint" then
event:FireClient(player, "Sprint")
elseif equippedpower.Value == "FakeGun" then
local fakegun = serverstorage:WaitForChild("Fake Gun")
fakegun:Clone().Parent = backpack
elseif equippedpower.Value == "Shield" then
event:FireClient(player, "Shield")
end
end
local equippedknife = player:WaitForChild("EquippedKnife")
local weapontogive = serverstorage:FindFirstChild(equippedknife.Value)
if weapontogive then
weapontogive:Clone().Parent = backpack
end
elseif player == sheriff then
local equippedgun = player:WaitForChild("EquippedGun")
local weapontogive = serverstorage:FindFirstChild(equippedgun.Value)
if weapontogive then
cloned = weapontogive:Clone()
cloned.Parent = backpack
else
warn("No weapon to give!")
cloned = serverstorage:FindFirstChild("Revolver"):Clone()
cloned.Parent = backpack
end
local equippedpower = player:WaitForChild("EquippedPower")
if equippedpower.Value == "FasterReload" then
local val = cloned:WaitForChild("FasterReloadCheck")
val.Value = 1
end
event:FireClient(player, "Class", "Sheriff")
else
event:FireClient(player, "Class", "Bystander")
local equippedpower = player:WaitForChild("EquippedPower")
if equippedpower.Value == "FakeGun" then
local fakegun = serverstorage:WaitForChild("Fake Gun")
fakegun:Clone().Parent = backpack
end
end
end
end
end
end