Im trying to spawn a part called "wall1"
when someone touches the part with this script and has more than 4 points but I dont think it recognizes that. this is the script so far i wrote. output says 16:53:39.847 - Workspace.Part.Script:5: attempt to compare number with nil 16:53:39.847 - Stack Begin 16:53:39.848 - Script 'Workspace.Part.Script', Line 5 16:53:39.849 - Stack End
function Buy()
player = game:GetService("Players").LocalPlayer
stats = player:findFirstChild("leaderstats")
Points = stats:findFirstChild("points")
if Points > 4 then
Points.Value = Points.Value - 5
wall = Instance.new("Part")
wall.Parent = workspace
wall.Size = Vector3.new(5 ,5 , 1)
wall.Postition = Vector3.new(10 ,5 ,5)
wall.Anchored = true
script.Parent:Destroy()
end
end
script.Parent.Touched:connect(Buy)
