RemoteFunction really doesnt feel like firing

while true loop isn’t adviced, it wont let any other code run, you should put it on another script or change it, also, are you making sure that the script and the client are actually using the same remote function/remote event?

Looks like the client code doesn’t even get executed? If the explorer picture you have shown earlier is correct, then maybe the script context is wrong. Is it a localscript? Or does it have the context set to client?

There was a recent roblox change that modifies script behaviour.

Try using RemoteEvent (named GiveCash) instead, here’s code:

Server code:

local function GiveCash(player, amount)
– [The rest of your function remains the same]
end

game.ReplicatedStorage.GiveCash.OnServerEvent:Connect(GiveCash)

Client code:

script.Parent.CashButton.MouseButton1Click:Connect(function()
game.ReplicatedStorage.GiveCash:FireServer(game.Players.LocalPlayer, 20)
end)

if you edited it then its your own fault. for me it worked fine.

i added the while true… if thats the reason then im going to cry

like people before me said. a loop of any kind haults further executions unless your running it in another script. That is the issue. If you read RemoteFunction really doesnt feel like firing - #41 by lamcellari then you’d know.

It is not hard to restructure your code.

Yes - Put the while true do end in a separate script under the label. Everything works now. Oh my god it took me so long to figure that out

That wasn’t the only issue but this was the last final issue. Just remember to put it inside of an separate script or a the very bottom of the current. You can also just use remote events and fire the client with the updated value and handle it from there on the client that way you wouldn’t need a loop. Also doing while task.wait() do end is the same as doing while true do task.wait() end

Yes, i will probably play around with remote functions as they return a value next

remote events send data to and from the client and server and remote functions get fired and return data.

Yes - localscript fires the function and updates the label with the data from the server

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.