I’m wanting to have a remotefunction
that returns a boolean.
this error is in the output:
and here is the
localScript
that may be causing it
local event = game.ReplicatedStorage.RequestPrompt
local Donator = game.ReplicatedStorage.Donators.RequestBase
local Frame = script.Parent
local plr = game.Players.LocalPlayer
event.OnClientInvoke:Connect(function(plr2)
local Return = nil
local clone = Donator:Clone()
clone.Parent = Frame
clone.PlayerLabel.Text = plr2 .." Party Up?"
local Accept = clone.Accept
local Decline = clone.Decline
Accept.Activated:Connect(function()
Return = true
clone:Destroy()
end)
Decline.Activated:Connect(function()
Return = false
clone:Destroy()
end)
clone.Destroying:Connect(function()
return Return
end)
end)
ITemply
(tem)
May 19, 2024, 7:38pm
#2
try:
event.OnClientInvoke = function(plr2)
instead of:
event.OnClientInvoke:Connect(function(plr2)
1 Like
It fixed the error, but it always returns as nothing. anyway to fix that?
ITemply
(tem)
May 19, 2024, 8:02pm
#4
do the return like here and get rid of the destroying part
Accept.Activated:Connect(function()
Return = true
return Return
clone:Destroy()
end)
(maybe, u might wanna check if everything is activating too)
it seems to have this error:
gamincwc
(Dejan)
May 19, 2024, 8:51pm
#6
show a ss of the latest code so I can see where you are missing a end
iondrive
(iondrive)
May 19, 2024, 8:52pm
#7
You have a line of code after the return:
return Return
clone:Destroy()
The clone:Destroy() call will never run as the function will return before it.
how would i get the instance to destroy then?
gamincwc
(Dejan)
May 19, 2024, 8:54pm
#9
I don’t know what you are talking about rn because I don’t have an idea of what the script looks like
gamincwc
(Dejan)
May 19, 2024, 8:55pm
#11
try instead of function accept() do local function accept() and same with the other one
that changed nothing @gamincwc
gamincwc
(Dejan)
May 19, 2024, 8:57pm
#13
what is Accept, a gui button? oh and also you don’t need the Return variable
what? is there another way to get a bool from the remotefunction
?
gamincwc
(Dejan)
May 19, 2024, 8:59pm
#15
the Accept I assume is a button so try instead of .Activated do .MouseButton1Clicked
.Activated is not even used that much as it is a property and not an event
I fixed it by putting clone:destroy()
before return
and i added
repeat wait() until Return ~= nil
return Return
to the end of the OnClientInvoke
event.
system
(system)
Closed
June 2, 2024, 9:06pm
#17
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.