DasKairo
(Cairo)
March 26, 2023, 10:45pm
1
So I’m trying to Send a Piece of Data using a BindableFunction using OOP, but I cant seem to figure out how, as I have tried creating a function like this:
self.SendData = function()
return MapData
end
And Setting the Function to the BindableEvent:
function Mod:SetDataOnInvoke()
print(MapData)
SendData.OnInvoke = self.SendData
end
But This doesnt work at all.
SendData:Invoke() -- no errors, but nothing happens
What Should I do?
Do you mean BindableFunction?
Also, what is MapData? Is it the event returned by SendData? If so, you need to do: SendData():Invoke().
m9phase2
(phase)
March 26, 2023, 10:58pm
3
there’s not much I can understand from this, try calling SendData
DasKairo
(Cairo)
March 26, 2023, 10:58pm
4
Whoops.
SubtotalAnt8185:
Also, what is MapData?
Its a Table:
MapData = {
Name = map.Name,
BGM = map.Settings.BGM.Value
Difficulty = math.clamp(map.Settings.Difficulty.Value, 1, #DifficultyData)
}
Nope, I added a Print inside it to check, it doesnt print, however I forgot to Include the print for the Topic.
DasKairo
(Cairo)
March 26, 2023, 11:00pm
5
No, Because Im trying to add the function to the BindableFunction so it can be fired from there.
Do you mean this one doesn’t print?
m9phase2
(phase)
March 26, 2023, 11:03pm
7
they meant inside the SendData function
1 Like
DasKairo
(Cairo)
March 26, 2023, 11:03pm
8
No, I meant this one, which was where I forgot to put print()
m9phase2
(phase)
March 26, 2023, 11:05pm
9
does SendData get assigned at instancing? (when calling the constructor)
commitblue
(commitblue)
March 26, 2023, 11:05pm
10
We need more info of this problem. whats senddata?
m9phase2
(phase)
March 26, 2023, 11:06pm
11
a function that returns a MapData array
commitblue
(commitblue)
March 26, 2023, 11:07pm
12
not self.SendData. Just senddata
m9phase2
(phase)
March 26, 2023, 11:07pm
13
I just tested the same setup and it works for me, so it’s either some other factor or you not calling that method
m9phase2
(phase)
March 26, 2023, 11:08pm
14
apparently it’s a BindableEvent
m9phase2
(phase)
March 26, 2023, 11:09pm
15
is the MapData array a global object? @DasKairo
DasKairo
(Cairo)
March 26, 2023, 11:09pm
16
Yeah, I made sure to test with another Map, and yes, its working, so its likely something else.
I meant to say BindableFunction, that was my bad.
Yes, Because if I add it to self, it would just overcomplicate things that I have with my code.
m9phase2
(phase)
March 26, 2023, 11:11pm
17
nah my bad I meant to write bindablefunction. what if there’s some yielding in the mapdata array values? have you tried calling other functions?
m9phase2
(phase)
March 26, 2023, 11:11pm
18
but no that wouldn’t make sense since you’re not calling waitforchild. idrk
system
(system)
Closed
April 9, 2023, 11:11pm
19
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.