Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Post With script for marine filler filler pumpkin killer part 2 eletric boogalo?

Need to make the code fit the player it derived from the RemoteEvent

CODE:


local DeathEvent = game.Workspace.BindableEvents:WaitForChild("DeathEvent")

DeathEvent.OnServerEvent:Connect(function(Player) 
	
print("DeathEvent Ran")
local SIREN = game.Workspace.SirenHeadBot
SIREN.SirenHeadAI.Disabled = true
SIREN.Animate.Disabled = true


game.Players.PlayerAdded:Connect(function(Player)
    Player.CharacterAdded:Connect(function(Char)
        local Part = Char:WaitForChild("HumanoidRootPart") 
        local Weld = Instance.new("Weld", Char)
		Weld.Name = "Something"
		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()
	local Weld = plr.Character:FindFirstChild("Something")
	plr.Character.Humanoid.Died:Connect(function()
            print("ded")
            SIREN.SirenHeadAI.Disabled = false
            SIREN.Animate.Disabled = false
            Weld:Destroy()
        end)
end)

1 answer

✓ Accepted answer

here is script two:


local SIREN = game.Workspace.SirenHeadBot

function playerToHand(player)
	print("DeathEvent Ran")
local Char = player.Character
local SIREN = game.Workspace.SirenHeadBot
SIREN.SirenHeadAI.Disabled = true
SIREN.Animate.Disabled = true
 	local Part = Char:WaitForChild("HumanoidRootPart") 
        local Weld = Instance.new("Weld", Char)
        Weld.Name = "Something"
        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()
	Char.Humanoid.Died:Connect(function()
            print("ded")
            SIREN.SirenHeadAI.Disabled = false
            SIREN.Animate.Disabled = false
            Weld:Destroy()
        end)


end

SIREN.Touched:Connect(function(hit)
	local player = game:GetService("Player"):GetPlayerFromCharacter(hit.Parent)
	if player then
		playerToHand(player)
	end

end)

This discussion is preserved as it was. New answers, comments, and votes are closed.