This is my first question, so please go easy on me.
So I've been working on a car spawn UI, and I need to communicate from the LocalScript to the Script in the workspace which spawns the car. However, it doesn't seem to want to communicate to the RemoteFunction.
EDIT
I added a print("Invoked.") to make sure the MouseButton1Up event is working, and sure enough, it was. However, anything after the invoke command is ignored.
EDIT 2
Now I'm getting errors since I followed a suggestion from the comments.
LocalScript error:
09:56:29.067 - Workspace.Part.Script:7: bad argument #2 to '?' (string expected, got Object)
09:56:29.068 - Stack Begin
09:56:29.068 - Script 'Workspace.Part.Script', Line 7
09:56:29.069 - Stack End
Script error:
09:56:29.102 - Workspace.Part.Script:7: bad argument #2 to '?' (string expected, got Object)
09:56:29.103 - Stack Begin
09:56:29.103 - Script 'Players.Pixelated_MC.PlayerGui.SpawnCarUI.Frame.LocalScript', Line 14
09:56:29.103 - Stack End
LocalScript:
script.Parent.ChooseCar.ChooseCar.MouseButton1Up:Connect(function()
script.Parent.ChooseCar.Visible = false
script.Parent.CarList.Visible = true
script.Parent.Title.Text = "Please choose a car from the list."
end)
script.Parent.ChooseCar.CustomCar.MouseButton1Up:Connect(function()
script.Parent.ChooseCar.Visible = false
script.Parent.CustomCar.Visible = true
script.Parent.Title.Text = "Please enter an ID below."
end)
for i,v in pairs(script.Parent:WaitForChild("CarList"):GetChildren()) do
if v.Name == "Item" then
v.Icon.Spawn.MouseButton1Up:Connect(function()
script.Parent.Original.Value:Invoke(v.Spawn.Text)
print(script.Parent.Original.Value)
end)
end
end
Script:
script.Parent.ClickDetector.MouseClick:Connect(function(player)
script.Parent.BrickColor = BrickColor.Red()
local gui = script.Parent.SpawnCarUI:Clone()
gui.Frame.Original.Value = script.Parent.SpawnCarFunction
gui.Parent = player.PlayerGui
script.Parent.SpawnCarFunction.OnInvoke = function(carName)
local car = game.ServerStorage.Cars[carName]:Clone()
car.Parent = game.Workspace
car:MoveTo(game.Workspace.SpawnLocation.Position)
end
end)
You can view the image of my explorer here.
I have no errors, so what is the problem?
Thank you.

6 comments
SpawnCarUI is a Screen Gui, try moving it to the Starter Gui section of the game first
Yeah I know, but I want it in the button so only one person at a time can use the UI, and I'm going to make a script which closes the garage door to prevent anyone from tampering the other player's spawn car.
The RemoteFunction has the events: InvokeServer and OnServerInvoke, not "Invoke" EDIT: Noticed this is a Bindable Event, XD
Did you look at the image of my explorer? You might be able to better understand it. I will try to do what you are saying.
Is there a "spawn" under the icon?
Yes.