Hello ! I made this script but it doesn't work, I have this error which appears but why? My error: attempt to index local 'player' (a nil value) at the line 3 and 15
script.Parent.Touched:Connect(function(hit) local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent) player.Price.Value = 20 print(hit.Parent) if hit.Parent.Name == "Pickaxe" then script.Parent.BrickColor = BrickColor.new("Really blue") local pickaxe = hit.Parent.Parent:WaitForChild("Pickaxe") pickaxe:WaitForChild("LocalScript").Disabled = false end end) script.Parent.TouchEnded:Connect(function(hit) print(hit.Parent) local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent) player.Price.Value = 10 script.Parent.BrickColor = BrickColor.new("Really red") player.Price.Value = 10 local pickaxe = hit.Parent.Parent:WaitForChild("Pickaxe") pickaxe:WaitForChild("LocalScript").Disabled = true end)