Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

bad argument #3 to 'Text' (string expected, got Object) ?

bad argument #3 to 'Text' (string expected, got Object) ? issue is in server script

Local Script :



local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
		  game.ReplicatedStorage.msg:FireServer(script.Parent.Parent.TextBox.Text)
end)
script.Parent.Parent.TextBox.FocusLost:Connect(function(enterPressed)
		  game.ReplicatedStorage.msg:FireServer(script.Parent.Parent.TextBox.Text)
end)


Server Script :


			wait(3)
			game.Lighting.Msg:Clone().Parent =script.Parent.Head
			function fs1(text)
script.Parent.Head.Msg.Image.Texter.Text = text
end
game.ReplicatedStorage.msg.OnServerEvent:Connect(fs1)

1 comment

0

You need to filter text created by a user before showing it to other players in the game!!!

1 answer

The first parameter of OnServerEvent is always the player that fired the remote. Therefore, you just need to add it to your function's arguments.

wait(3)
game.Lighting.Msg:Clone().Parent =script.Parent.Head

function fs1(player, text)
	script.Parent.Head.Msg.Image.Texter.Text = text
end

game.ReplicatedStorage.msg.OnServerEvent:Connect(fs1)

1 comment

0

Now show this issue : bad argument #3 to 'Text' (string expected, got Object)

This discussion is preserved as it was. New answers, comments, and votes are closed.