BindableEvent invoke gives strange error.
OnButtonPressed.OnInvoke = function(Response)
end
In the script editor this is underlined for some reason.
When I hover on it, it says " Type ‘(any) -> ()’ could not be converted into ‘(any) -> g52’ " . Can anyone tell me how to fix this?
I am using --!strict
by the way, please don’t ask me to remove it, I want to solve this error without removing strict.
1 Like
sleitnick
(sleitnick)
November 27, 2020, 3:27pm
#3
Do you have any code within that function yet? If so, what is it and what are you returning? Also, I assume you mean a RemoteFunction and not a RemoteEvent?
2 Likes
@sleitnick @taker4300
It’s a BindableFunction.
Here is the code, its being used in SendNotification by the way.
local OnButtonPressed: BindableFunction = Instance.new("BindableFunction")
OnButtonPressed.OnInvoke = function(Response: string)
if (Response == "Yes") then
MarketplaceService:PromptProductPurchase(LocalPlayer,1121741086)
return true
end
return false
end
OnButtonPressed.Parent = script
StarterGui:SetCore("SendNotification",{
Title = "place holder",
Text = "place holder",
Icon = "place holder",
Button1 = "Yes",
Button2 = "No",
Callback = OnButtonPressed
})
sleitnick
(sleitnick)
November 27, 2020, 3:42pm
#5
I think this is just a bug with the type-checker, or at least with the configuration of BindableFunctions. Your code is valid. It only one return type (boolean
), and the type-checker seems to pick up on that fine.
I wonder what “g33
” is supposed to be?
2 Likes
taker4300
(Taktici)
November 27, 2020, 3:47pm
#6
Whats the error? you just added the “: string” thing but you didnt explain whats wrong
I have mentioned it in the screenshot.
taker4300
(Taktici)
November 27, 2020, 3:49pm
#8
My bad, sorry it was really small that not enough to me notice it.
rogchamp
(pasta)
November 27, 2020, 7:00pm
#9
Have you tried specifying the return of the function? Whatever g33 is could be a default that’s throwing it off.
3 Likes