when the script runs, i get an error Players.ieatandisbaconhair.PlayerGui.LocalScript:4: attempt to index local 'player' (a nil value). How do i fix it? thanks!
script:
local debounce = false local cam = game.Workspace.CurrentCamera game.ReplicatedStorage.EnterPaintShop.OnClientEvent:Connect(function(player) local player = player for i,v in pairs(player.Character:GetChildren())do if v:IsA("Model") and v.Name == player.Name.."'s Car" then v:Destroy() end for _,k in pairs(cam:GetChildren())do k:Destroy() end if not debounce then debounce = true local c = player:WaitForChild("SelectedCar").Value:Clone() c.Parent = game.Workspace.CurrentCamera c:SetPrimaryPartCFrame(game.Workspace.painttp.CFrame) player.Character.Torso.CFrame = player.Character.Torso.CFrame + Vector3.new(3,0,3) player.Character.Humanoid.WalkSpeed = 0 player.PlayerGui.PaintGUI.Enabled = true cam.CameraSubject = game.Workspace.painttp debounce = false end end end)