So, essentially, I want to update the text of a TextBox GUI every five seconds with a value from a server script. I’m aware that parameters can solve this issue, but I don’t really know how to implement them correctly in this situation with UI and RemoteEvents, and the fact that I’m very much a beginner of lua doesn’t help either. I’ve provided the code for the feature that I was hoping to make. Whenever I execute the code, the output just states, “Unable to cast value with object”, while referring to line 4 of the server script. Any feedback is very much appreciated!
Server Script Code
local remote = game.ReplicatedStorage.RemoteEvent value = 5 local function sendstuff(eu) remote:FireClient(eu) end while true do wait(5) sendstuff(value) end
local gui = script.Parent local function update(value) gui.Text = (value) end game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(update)