Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to correctly use parameters in FireServer:()? (SOLVED IT MYSELF)

Asked by 3 years ago
Edited 3 years ago

CLOSED, I SOLVED IT MYSELF!

Hello, Devs!

So I was trying to make TextBox that if you will put any number in it, it will print the number on the server, not on client. I tried using RemoteEvents and parameters for FireServer:() and OnServerEvent, but it printed out only player username that put the number in output. Thanks in advice.

CODE:

LOCAL SCRIPT

local player = game.Players.LocalPlayer

script.Parent.FocusLost:Connect(function()
    game.ReplicatedStorage.RemoteEvent:FireServer(player, tonumber(script.Parent.Text))
end)

SCRIPT

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player, text)
    print(player, text)
end)

OUTPUT:

No errors

ErktikyYT ErktikyYT Server

DETAILS:

Local script located in textbox, textbox located in ScreenGui script located in workspace remote event located in ReplicatedStorage

0
You don't need to send the player yourself, Roblox does that for you. So just do: FireServer(Text); herokuwu 41 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

I am suggesting you to check https://developer.roblox.com/en-us/api-reference/function/RemoteEvent/FireServer

0
I already checked it but that didn't helped. ErktikyYT 89 — 3y
0
ok Toxicheroking77 -8 — 3y
Ad

Answer this question