[SOLVED] Help with roblox server script mistaking Instance for Player

Hi! I’m making a flight simulator, which works by the player going up to a spawner, picking a plane and it spawns.

And it works to the point that the player selects the aircraft, because then i need to do a remote event to the server to spawn the plane. Somehow though, the server mistakes the plane for the Player once the remote event is sent.

I tried looking for solutions on the DevForum but apparently no one is talking about this specific problem. I’m going insane. Help is very appreciated as i am now stuck and cant go further in my project.

Client and Server Script aswell as the error itself:

client:

local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
	local planeName = script.Parent.Name
	game.ReplicatedStorage.AircraftSelectAfterSelection:FireServer(player, planeName)
end)

server:

game.ReplicatedStorage.AircraftSelectAfterSelection.OnServerEvent:Connect(function(player, planeName)
	local Player = player
	local plane = game.ServerStorage:WaitForChild(planeName.Name):Clone()
	print("plane found")
end)

-- the code here doesn't go further than receiving the event

output:
image

1 Like

It’s not. You don’t need to pass the player parameter through a FireServer it automatically gets sent through. So your sending the player twice

Oh… im just kinda dumb. It worked. Thanks.

1 Like

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