Hi, I have a bindable event that fires whenever a player has killed someone with a knife, this script works as its should but I am having some problems with firing the bindable event.
Also, basically this bindable event is just transferring two players names from one script to another.
--Knife script
kill = hit.Parent.Humanoid.Died:connect(function() print("Player has died") game:GetService("ServerStorage").KilledPlr:Fire(script.Parent.Parent.Parent.Name,hit.Parent.Name) wait(2) kill:disconnect() end)
And yes, it prints "Player has died" but it does not fire the bindable event.
Here is the other server script recieving the bindable event.
local bindable = game:GetService("ServerStorage").KilledPlr bindable.Event:Connect(function(plrname,plrkilled) print("Event fired") game:GetService("ServerStorage").DiedScreen.Main.KilledBy.Text = "You have been killed by "..plrname.."!" game:GetService("ServerStorage").DiedScreen:Clone().Parent = game:GetService("Players")[plrkilled].PlayerGui wait(3) game:GetService("Players")[plrkilled].PlayerGui.DiedScreen:Destroy() end)
Basically the "Event" function doesnt run. This is really frustrating and I hope someone can help.
Additional info: Bindable event is stored in serverstorage.
Thanks!
I know this is a year late, but I figured I'd post it anyway for others who come by later. I'm not sure why the bindable events aren't working, and I actually just encountered this same issue, but I found a fix for it that works for me. Use bindable functions instead of events. To be completely honest, I don't know the difference between the two, so there might be something with this idea that doesn't work, but either way, I'll post it. Here's a comparison of bindable event usage to bindable function usage:
Bindable Event: "Firing" Script:
bindableEvent:Fire(arg1,arg2)
"Fired" Script:
bindableEvent.Event:Connect(function(arg1,arg2) -- Insert script stuff here end)
Bindable Function: "Firing" Script:
bindableFunction:Invoke(arg1,arg2)
"Fired" Script:
bindableFunction.OnInvoke = function(arg1,arg2) -- Insert script stuff here end
I hope this helps anyone else who comes along and has this same issue like I did.