My friend is making a shop GUI and when you press a button, it spawns a vehicle (a bus). She is stuck on the script, ad in fact, doesn’t know what to put, and i don’t either. How would i/she achieve this? When you press the button, it is meant to spawn something? She has taken tutorials but finds them confusing. I will be able to understand your help! Not only would it help her, but it will help me a lot!
Thanks!
Also, she deleted the script, so there is no current script.
GUI.Frame.Button.MouseButton1Down:Connect(function()
local Bus = game:GetService("ReplicatedStorage"):FindFirstChild("Bus")
local BusClone = Bus:Clone()
BusClone.Parent = game.Workspace
end)
And put the bus in ReplicatedStorage, if you are using FilteringEnabled, use this:
GUI.Frame.Button.MouseButton1Down:Connect(function()
local Rep = game:GetService("ReplicatedStorage")
local Bus = Rep:FindFirstChild("Bus")
Rep.RemoteEvent.FireServer(Bus)
end)
and this script in the server:
local Rep = game:GetService("ReplicatedStorage")
Rep.RemoteEvent.OnServerEvent:Connect(function(player, car)
local ChoosenCar = Rep:FindFirstChild(car)
local CloneCar = ChoosenCar:Clone()
CloneCar.Parent = game.Workspace
end)
Please look around for systems like this and maybe break them down. There are many YT tutorials for car shop GUIs if you take your time maybe rewind you can figure it out if you have a basic understanding of Roblox LUA scripting.