script.Parent.MouseButton1Down:connect(function()

if game.Players.LocalPlayer.PlayerGui:FindFirstChild("VeichleSpawn") then
	game.Players.LocalPlayer.PlayerGui.VeichleSpawn:Destroy()
else
	game.ServerStorage.VeichleSpawn:Clone().Parent = game.Players.LocalPlayer.PlayerGui
end

end)

This script works on Solo mode (studio) , but does NOT work on the server mode (online).

I also tried putting the same script in a LocalScript type of Script, but that makes it worse since that doesn't even work on Solo mode.

help?

2 comments

2

game.Players.LocalPlayer only works inside of a LocalScript.

0

LocalScripts will only work inside PlayerGui, Backpack, PlayerScripts, and Player's Character. LocalPlayer only works in LocalScripts. Any chance you could provide any errors within your code when you're testing Play Solo with a LocalScript? Additionally, could you properly code block your code? It's the Lua icon in the editor.