Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

1 comment

0

The mouse button 1 click listener is returning proceed not OnStartGame or wherever you expected the result to be from,

1 answer

You have to do

OnClientInvoke:Connect(function(OnFindingAnswer))

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

This discussion is preserved as it was. New answers, comments, and votes are closed.