Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

Bindable event not firing?

Asked by
iladoga 129
6 years ago

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!

1
at least say what type of scripts they are User#23365 30 — 6y
0
They are both server scripts, bindable events only use server scripts. Think before you comment bro. iladoga 129 — 6y
0
Bindable events also work on the client. I personally use them and they function perfectly on the client. User#25115 0 — 6y
0
bindable events are for server to server and client to client communication @iladoga User#23365 30 — 6y
View all comments (2 more)
0
Did you make sure that both scripts are enabled? firestarroblox123 440 — 5y
0
Use a remoteevent instead. 9mze 193 — 5y

1 answer

Log in to vote
0
Answered by 4 years ago

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.

Ad

Answer this question