How to fire a string from client

So, I need to fire a string to a server script for me to apply this string as text.
I know that :FireServer() automatically sends anything as an instance, but is there a way to… bypass it?

This is what I have right now:

Event.OnClientEvent:Connect(function()
	print(player, Table[TableID]) --just me printing if it even works or no :v
	AnotherEventLol:FireServer(player, ""..Table[TableID]) --my attemts converting that into string lol
end)

And this is an error:
image

OnServerEvent’s first argument will already be the player Instance, so you do not actually need to place the player instance inside the FireServer argument, maybe that’s why you’re not getting the right results!

nope, still errors with the same message (but i guess this is acutally quite helping tip anyway)

Can we see the updated localscript and also the OnServerEvent on the serverscript?

Can’t figure out what you are trying to do as a general idea, but I can provide you with tostring() which converts data to strings.

Example:
print(1) Will print 1 as a number
print(tostring(1)) Will print 1 as a string

So replace ""..Table[TableID] with tostring(Table[TableID])

Sure!

Local script (updated):

Event.OnClientEvent:Connect(function()
	print(player, Table[TableID])
	AnotherEventLol:FireServer(""..Table[TableID])
end)

Server script:

AnotherEventLol.OnServerEvent:Connect(function(request)
	plr.PlayerGui["TEST UI"].TextLabel.Text = request
end)

Like I said, the first argument of OnServerEvent will always be the player, that means that the request variable you’re using is actually the localplayer that used :FireServer! You should instead do this:

AnotherEventLol.OnServerEvent:Connect(function(player, request)
	plr.PlayerGui["TEST UI"].TextLabel.Text = request
end)
-- (Maybe you might wanna change 'plr' to 'player' btw)
1 Like

oh! yes! this works! (and another reply too) thanks everyone a lot! (god events are confusing, but i understand now, i just thought that i dont need to specify that on server)

Nice to know that it actually worked! You can take a look at the RemoteEvent documentation if you want to learn more about it :slight_smile:

1 Like

Sure thing! I should’ve read that earlier, I just literally self taught myself from other people’s ideas with Events

So thanks once again!

Have a great day!

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