Change the text on a SurfaceGui via a RemoteEvent error

Hey, first time poster on this topic. I couldn’t find a solution to this issue so I came here. I’m trying to work on a project that changes the text on a surfaceGui via a gui. Everything is going smooth but then at the very end I’m getting this error

  • Workspace.GateScreen.FilteringEnabled.Script:2: invalid argument #3 (string expected, got Instance)

here’s the code:

function change(statu, fl, sch, est, destination)

script.Parent.Parent.main.Screen.SurfaceGui.ImageLabel.status.Text = (statu)

script.Parent.Parent.main.Screen.SurfaceGui.ImageLabel.flightNum.Text = (fl)
script.Parent.Parent.main.Screen.SurfaceGui.ImageLabel.scheduledTime.Text = (sch)
script.Parent.Parent.main.Screen.SurfaceGui.ImageLabel.estTime.Text = (est)
script.Parent.Parent.main.Screen.SurfaceGui.ImageLabel.dest.Text = (destination)
end

script.Parent.ChangeStuff.OnServerEvent:Connect(change)

May you change it to code blocks please?

Use ``` at start and end

1 Like

Done, sorry.

fillerfillerfillerfiller

Can you send the code that fires the remoteevent?

Sure, it’s long though.

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local screen
local gui = script.Parent.Frame

function selection()
	gui.status.Text = screen.Screen.SurfaceGui.ImageLabel.status.Text
	gui.flNum.Text = screen.Screen.SurfaceGui.ImageLabel.flightNum.Text
	gui.schedTime.Text = screen.Screen.SurfaceGui.ImageLabel.scheduledTime.Text
	gui.estTime.Text = screen.Screen.SurfaceGui.ImageLabel.estTime.Text
	gui.dest.Text = screen.Screen.SurfaceGui.ImageLabel.dest.Text
end
mouse.Button1Down:Connect(function()
	script.SelectionPartLasso.Humanoid = player.Character.Humanoid
	if mouse.Target ~= nil and mouse.Target.Name == "Screen" and mouse.Target.Parent.Name == "main" then
		screen = mouse.Target.Parent
		script.SelectionPartLasso.Part = screen.Screen
	else
		screen = nil
		script.SelectionPartLasso.Part = nil
	end
	script.Parent.Frame.Visible = false
	if screen then
		script.Parent.Frame.Visible = true
		selection()
	end
end)

script.Parent.Frame.submit.MouseButton1Click:Connect(function()
	screen.Parent.FilteringEnabled.ChangeStuff:FireServer(
		gui.status.Text,
		gui.flNum.Text,
		gui.schedTime.Text,
		gui.estTime.Text,
		gui.dest.Text
	)
end)
  • Workspace.GateScreen.FilteringEnabled.Script:2: invalid argument #3 (string expected, got Instance)

Which one is line two?

This one, it put spaces in for no reason.

script.Parent.Parent.main.Screen.SurfaceGui.ImageLabel.status.Text = (statu)

Try changing “status” to some other name

Wait, don’t do that. Did you pass through the player in the function? Try doing:
function change(ply, statu, fl, sch, est, destination)

no i didn’t. should i do this?

LOCAL SCRIPT
screen.Parent.FilteringEnabled.ChangeStuff:FireServer(
		player,
		gui.status.Text,
		gui.flNum.Text,
		gui.schedTime.Text,
		gui.estTime.Text,
		gui.dest.Text
	)
SCRIPT
function change(player, statu, fl, sch, est, destination)

player,

Delete that line, the player is passed through first automatically

it has worked. I really appreciate the help you’ve given me and the patience you’ve shown. thanks!

You’re welcome! Best of luck with your project

1 Like