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


