I’m trying to make it so that when the client (there is a max of one player per server) inputs something into their TextBox it changes a Server side String Value. I tried using FireServer, but I’m getting this error:
Are you sure you’re indexing the remote properly? It looks like FindFirstChild is returning a StringValue, not a RemoteEvent. FindFirstChild returns the first child it finds with the name of the first argument you call it with. Make sure you call it with the correct name or it won’t work properly, alternatively if you have only 1 RemoteEvent you can call ReplicatedStorage:FindFirstChildOfClass("RemoteEvent") and see if that helps.
local remoteEvent = ReplicatedStorage:FindFirstChild(“Duration”)
remoteEvent.OnServerEvent:Connect(function(val)
–the text is defined as “val” so if you edited a UI it would be like; script.Parent.TextLabel.Text = val
end)
@j8cksxn the “OnServerEvent” can only be ran from a script, not locally, you want to fireserver from a local script, and then it will be picked up by the OnServerEvent.
OK. You should move the ReplicatedStorage and the remoteEvent variable out of the function for better usage. And move the onServerEvent out of the function aswell. Also, you could add a print(val) to see if it’s what it should be.