I made a spawner, but when i click G, it wont do anything.
first script (at the startergui):
local uis = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local name = plr.Name..("'s Car")
local debounce = false
uis.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.G then
for i,v in pairs(game.Players.LocalPlayer.Character:GetChildren())do
if v:IsA("Model") and v.Name == name then
v:Destroy()
end
end
end
end)
uis.InputEnded:Connect(function(aey)
wait()
game.ReplicatedStorage.SpawnCarEvent:FireServer()
end)
second script(at the workspace):
local debounce = true
local uis = game:GetService("UserInputService")
game.ReplicatedStorage.SpawnCarEvent.OnServerEvent:Connect(function(plr)
uis.InputBegan:connect(function(aey)
if aey.KeyCode == Enum.KeyCode.G then
if not debounce then
wait()
local car = plr.SelectedCar.Value:Clone()
car.Parent = game.Players.LocalPlayer.Character
car.Chassis.Base.Anchored = true
car.Name = plr.Name..("'s Car")
car:SetPrimaryPartCFrame(plr.Character.Head.CFrame * CFrame.new(0,0,-10))
car:MakeJoints()
car.Chassis.Base.Anchored = false
debounce = true
wait(0.1)
debounce = false
end
end
end)
end)
thanks for helping!

3 comments
You spelt "local" wrong. You typed "llocal".
Add print statementsto parts of your code, so you know which function is running and which functions is not, this will help narrow the problem down, also your first line, you spelled local wrong
Oh, it actually wasnt misspelled,i misspelled it in the site lmao.