So this code creates a wield between the player a part, however thought when you die the wield is supposed to be destoryed, but it isnt. No errors in output.
ALSO, when the script is destroyed in workspace and cloned back in workspace, the script dosent seem to create a wield anymore. Please help!
CODE:
local SIREN = game.Workspace.SirenHeadBot
SIREN.SirenHeadAI.Disabled = true
SIREN.Animate.Disabled = true
print("Teleport")
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Char)
local Part = Char:WaitForChild("HumanoidRootPart")
local Weld = Instance.new("Weld", Char)
Part.Position = Vector3.new(game.Workspace.Knife.Position)
script.Parent.Knife.CFrame = Part.CFrame
Weld.Part0 = game.Workspace.Knife
Weld.Part1 = Part
Weld.C0 = Part.CFrame:inverse()
Weld.C1 = game.Workspace.Knife.CFrame:inverse()
end)
end)
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:wait()
plr.Character.Humanoid.HealthChanged:Connect(function()
if plr.Character.Humanoid.Health <= 0
then
print("ded")
SIREN.SirenHeadAI.Disabled = false
SIREN.Animate.Disabled = false
Weld:Destroy()
end
end)
end)

6 comments
Does it print "ded" ?
The reason it may not work is because your connecting to an ongoing function which will continue to run after death try using :Disconnect at line 24
where do I put :disconnect?
Also try using a loop because when a player dies it will only do it once
well it dosent do it in the 1st place
Does it print ded