KYROdev
(shahzain)
December 17, 2020, 3:10pm
1
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)
vf9r
(vf9r)
December 17, 2020, 3:20pm
2
May you change it to code blocks please?
Use ``` at start and end
1 Like
Aegians
(Aegian)
December 17, 2020, 3:37pm
4
Can you send the code that fires the remoteevent?
KYROdev
(shahzain)
December 17, 2020, 3:38pm
5
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)
KYROdev
(shahzain)
December 17, 2020, 3:45pm
7
This one, it put spaces in for no reason.
script.Parent.Parent.main.Screen.SurfaceGui.ImageLabel.status.Text = (statu)
Aegians
(Aegian)
December 17, 2020, 3:50pm
8
Try changing “status” to some other name
Aegians
(Aegian)
December 17, 2020, 3:53pm
9
Wait, don’t do that. Did you pass through the player in the function? Try doing:
function change(ply, statu, fl, sch, est, destination)
KYROdev
(shahzain)
December 17, 2020, 3:59pm
10
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)
Aegians
(Aegian)
December 17, 2020, 4:01pm
11
player,
Delete that line, the player is passed through first automatically
KYROdev
(shahzain)
December 17, 2020, 4:04pm
12
it has worked. I really appreciate the help you’ve given me and the patience you’ve shown. thanks!
Aegians
(Aegian)
December 17, 2020, 4:06pm
13
You’re welcome! Best of luck with your project
1 Like