-
What do you want to achieve? Keep it simple and clear!
I want my local script to run when it receives a bindable event. -
What is the issue? Include screenshots / videos if possible!
The client fires a bindable event, and the script listening for it does not run. -
What solutions have you tried so far? Did you look for solutions on the Creator Hub?
I have tried changing the script that sends the event, the one receiving it, and I have also checked EVERYWHERE for typos.
The card game is very similar to rummy, and this is checking for a run. (same suit, in numerical order.) You press a button to scan your selected cards to see if they are a valid run, and if it is, the script in the button attempts to remove those cards from your deck and puts them down. Here is the problem: It sends the list to the PutDownCards event. But, the script controlling the deck never runs, showing that it never got the event.
Here’s the code for the run check button: (it works, and doesn’t print “firing putdowncards” because the previous line pauses it)
script.Parent.MouseButton1Click:Connect(function()
--checking if the run is valid, all works
if suitablerun then
script.Parent.Parent.PutDownCards:Fire(true, cards)
print("firing putdowncards")
end
end)
And this is the reciever of that script. Most of it is irrelevant, it just doesn’t run. (i know because it never prints “taking cards from player”.)
game:GetService("ReplicatedStorage").Events.DeckStatus.TakeCardsFromPlayer.OnClientEvent:Connect(function(cards)
print("taking cards from player")
for i, v in pairs(cards) do
local removedCard = false
for i, v in pairs(script.Parent:GetChildren()) do
if v:IsA("Frame") then
if v.Name == string.gsub(tostring(v), ",", " ") then
v:Destroy()
removedCard = true
break
end
end
end
print(removedCard)
end
end)
Any help would be appreciated. Thanks!