Hello i am having issues with client/server scripting.
So i have text box gui that when you fill it and press text button gui it will pass the text from text box to value in replicated storage. But there is problem, it is still in client and i don’t know how do i make it pass and making it visible in server. I know how to fire remote server but i don’t know how do i make it pass the value.
So once mouse button is clicked you fire the remote event to get picked up by the server.
You pass the information as arguments.
The fire server is a variadic function which takes unspecified number of arguments.
Meaning you can insert as many arguments into it’s parameters.
For example
Textbox = ScreenGUI.TextBox
local button = ScreenGUI.Textbutton
local remoteE = game.ReplicatedStorage.RemoteEvent
button.MouseButton1Down:Connect(function()
remoteE:FireServer(Textbox.Text)
end)
Now pick the call up from the server and change the value from there.
Okay so how do i make the text now passed into value in replicated storage. I know i need to write OnServerEvent and else. But im still new at learning remote events.
RemoteEvent.OnServerEvent:Connect(function(player,value)
game.ReplicatedStorage.StringValue.Value = value
end)
Notice we did not send player as an argument but in roblox studio this is added automatically as the first argument when picked up.
The Player from whom the local script fires server.
To understand way better and all the core concepts of remote events here is the api reference
RemoteEvent (roblox.com)
Reading this will clear up the confusion I hope.
Yeah that gives sense now! I have been trying figure this out realy long time Edit: Thanks for link about remote events!