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

Why is my bindable function stopping my script?

Asked by 3 years ago

hey all.

im trying to send data between two server scripts, and to that end im trying to use a bindable function that invokes the data i want to send on one end, and basically just grabs and saves it on the other.

something sort of like this:

relevant code in script with data

local ServerStorage = game:GetService("ServerStorage")
local bf = ServerStorage.DataPasser
bf:Invoke(transferid,transferplayer,ModifiableStatsDictionary)

relevant code in script that wants the data

bf.OnInvoke = function (transferid,transferplayer,ModifiableStatsDictionary)
    local localid = script.Parent.Name
    if transferid == localid then
        player = transferplayer
        StoredStatsDictionary = ModifiableStatsDictionary
    end
end

the problem im having is that the script that sends the data comes to the invoke line, and just stops. it doesnt throw an error or anything, the script just halts there and doesnt execute anything from that point forward. and from what i can tell, the second script doesnt do anything either.

have i writen something wrong? is it the way im checking for the correct id before saving the data? any input would be appreciated.

1 answer

Log in to vote
0
Answered by
zadobyte 692 Moderation Voter
3 years ago
Edited 3 years ago

With Bindable/Remote functions, you always need a return, whether it returns something or nothing.

0
^ This ^ zane21225 243 — 3y
0
event when the function has a return, nothing happens. the function never even seems to start running. Keleindor 9 — 3y
Ad

Answer this question