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

RemoteFunction (Server To Client) not returning when button is clicked?

Asked by 5 years ago

So, basically when Proceed is clicked in the Client, it won't return it.

-- Server

function OnStartGame()

GameLocation.Desk.TapePlayer.Speaker.TapeRecorder:Play()
wait(21)
GameLocation.Desk.TapePlayer.Speaker.TapeRecorder:Pause()   
local Answer = CallBacks.PromptAnswer:InvokeClient(game.Players[Values.GamePlayer.Value])   

if Answer == ("Proceed") then
GameLocation.Desk.TapePlayer.Speaker.TapeRecorder.TimePosition = 28
GameLocation.Desk.TapePlayer.Speaker.TapeRecorder:Resume()
wait(17)
Values.ControlsUsable.Value = true  
end

end

-- Client

function OnFindingAnswer()
script.Parent.Proceed.Visible = true
script.Parent.Reject.Visible = true
--
script.Parent.Reject.MouseButton1Click:connect(function()
script.Parent.Proceed.Visible = false
script.Parent.Reject.Visible = false

script.Parent.Alley.Visible = true
script.Parent.End:Play()
for i = 1,100 do
wait(.04)
script.Parent.Alley.ImageColor3 = Color3.fromHSV(0,0,i/100) 
end 
wait(10)
for i = 1,20 do
wait(.04)
script.Parent.Alley.ImageColor3 = Color3.fromHSV(0,0,1 + (-i/100))  
end 
TeleportService:Teleport(1314659324, game.Players.LocalPlayer)  
end)

script.Parent.Proceed.MouseButton1Click:Connect(function()
return "Proceed"    
end)
end

Callbacks.PromptAnswer.OnClientInvoke = OnFindingAnswer

0
The mouse button 1 click listener is returning proceed not OnStartGame or wherever you expected the result to be from, User#24403 69 — 5y

1 answer

Log in to vote
0
Answered by
Joshument 110
5 years ago

You have to do

OnClientInvoke:Connect(function(OnFindingAnswer))

using an = sign doesn't work because you need to connect a function to an event.

Ad

Answer this question