How to make a shop with events (Client to Server)

I have a racing-themed game with a garage with camera manipulation. I have a local script that will spawn a car on the stand and you can buy new cars and equip them. I have a problem though as it is in a local script. I think you can do something with events but have no idea what to do or where to start. I need it so the server has the kart with its properties so that other players can actually see the kart not just the client

This is my script. Keep in mind that I haven’t completed it, I just need help with how I can do the kart in the server, not the client.

local Player = game.Players.LocalPlayer
local garageButton = script.Parent
local Camera = game.Workspace.CurrentCamera

garageButton.MouseButton1Click:Connect(function()
	garageButton.Visible = false
	Camera.CameraType = Enum.CameraType.Scriptable
	Camera.CFrame = workspace:FindFirstChild("CameraPart"..Player.PlayerSet.Value).CFrame
	script.Parent.Parent.Parent.MenuGui.Enabled = false
	script.Parent.Parent.StopButton.Visible = true
	script.Parent.Parent.Parent.Parent.Team = game.Teams.Workshop
	print(script.Parent.Parent.Parent.Parent.Name.." Transferred to Garage")
	Player:FindFirstChild("InWorkshop").Value = true
	Player.Character.Parent = game.Workspace.WorkshopCheck
	Player.Character.HumanoidRootPart.CFrame = game.Workspace.WorkshopCheck.CFrame
	script.Parent.Parent.LeftButton.Visible = true
	script.Parent.Parent.RightButton.Visible = true
	script.Parent.Parent.KartName.Visible = true
	if Player.Karts:FindFirstChild("KartEquipped").Value ~= nil then
		for i, v in pairs(game.ReplicatedStorage.Karts:GetChildren()) do
			if v.KartNum.Value == Player.Karts.KartEquipped.Value then
				print("It worked")
				local kartclone = v:Clone()
				kartclone.Name = Player.Name.."'s Demo"
				kartclone.Parent = game.Workspace
				script.Parent.Parent.KartName.Text = kartclone.Name
				local playerNumber = Player.PlayerSet.Value
				if playerNumber == 1 then
					print("player number is 1")
					local spawn1 = CFrame.new(-9861.484, 93.602, 1377.433) * CFrame.Angles(0, math.rad(91.027), 0)
					kartclone:GetPrimaryPartCFrame(spawn1)
				end
			end
		end
	end
end)

script.Parent.Parent.StopButton.MouseButton1Click:Connect(function()
	garageButton.Visible = true
	Camera.CameraType = Enum.CameraType.Custom
	script.Parent.Parent.Parent.MenuGui.Enabled = true
	script.Parent.Parent.StopButton.Visible = false
	script.Parent.Parent.Parent.Parent.Team = game.Teams.Lobby
	Player:FindFirstChild("InWorkshop").Value = false
	Player.Character.Parent = workspace
	Player.Character.HumanoidRootPart.CFrame = game.Workspace.LobbyCheck.CFrame
	if game.ReplicatedStorage:FindFirstChild(Player.Name.."'s Kart") and Player.Karts:FindFirstChild(Player.Name.."'s Demo") then
		game.ReplicatedStorage:FindFirstChild(Player.Name.."'s Kart"):Destroy()
		Player.Karts:FindFirstChild(Player.Name.."'s Demo").Parent = game.ReplicatedStorage.PlayerKarts
		game.ReplicatedStorage.PlayerKarts:FindFirstChild(Player.Name.."'s Demo").Name = Player.Name.."'s Kart"
		print("Success")
	end
end)

Any help will be appreciated, thank you

The local script is like this:

local Button = script.Parent
Button.MouseButton1Click:Connect(function()
game.ReplicatedStorage.RemoteEvent:FireServer() --- You may edit this if you putted Remote event on different location.
end)

Server Script:

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(Player)
local Item1 = game.ServerStorage.Item1 --- The Item 
if Player.leaderstats.Cash.Value >= 100 then -- Item price/ In this line we get player leaderstats.
Player.leaderstats.Cash.Value -= 100
print("Purchase was success!")
local CloneItem1 = Item1:Clone()
CloneItem1.Parent = Player.Backpack
else
print("Not enough cash!")
end
end)

thank you for the quick response, I am testing now :slight_smile:

No problem! Any error, post it here.

I just ran into a problem. So when it is meant to teleport it just teleports to another spot :frowning:
I couldn’t upload a vid for some reason on dev forum so I did it on youtube:

I think you should make another post because it’s becoming off-topic