Im trying to fire an event when the bot dies.With the name of the player in it so the script knows who killed the bot.Here is the script: P.S It is very important for me because otherwise the quest cant work,pls help. Im always getting the error "Monkey is not a valid member of Players" but why is it detecting itself,btw monkey is the bot.
Local:
local Humanoid = script.Parent.Humanoid
local delayy = false
local remote = game.ReplicatedStorage.Check2
script.Parent.HumanoidRootPart.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid")then
local plr = game.Players[hit.Parent.Name]
elseif hit:FindFirstChild("PlayerName")then
local plr = game.Players[hit.PlayerName.Value]
script.Parent:WaitForChild("Humanoid").Died:Connect(function()
if delayy == false then
remote:FireAllClients(plr)
delayy = true
print("died")
wait(1)
delayy = false
end
end)
end
end)

3 comments
Bout to eat with family. If that doesn’t work I’ll look over it again later sorry.
Bout to eat with family. If that doesn’t work I’ll look over it again later sorry.
Oh when the bot dies sorry! I’ll change it real quick