This script is supposed to give you a ForceField when you click the text button when you have over 1000 points. I have 100,000 points but I don't get a ForceField, I don't lose any points either.

chr = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:wait()

script.Parent.MouseButton1Down:connect(function()
	print 'clicked'
    if game.Players.LocalPlayer.Points.Value > 999 then
	print 'Points are enough'
	local points = game.Players.LocalPlayer:WaitForChild("Points")
	local rl = chr:WaitForChild("RocksLeft")
	print 'loaded everything'
        if rl.Value < 15 then
			print 'cloned'
			points.Value = points.Value - 1000
			script.Parent.Parent.Balance.Text = "Points: "..game.Players.LocalPlayer.Points.Value
            local f = Instance.new("ForceField",game.Players.LocalPlayer.Character)
			rl.Value = 15
		end
	end
end)

No errors or anything in the output either.

EDIT I've tested it a few times and it won't print 'loaded everything'

I don't know how to fix this so please help.

5 comments

0

Is it a localscript?

0

Yeah

0

I think the problem is it's not loading points or rl.

0

Your conclusion makes sense to me (if "Points are enough" is getting printed out). I recommend debugging the scripts responsible for creating "Points" or "RocksLeft". Also, you access ".Points" (line 5) before using "WaitForChild" (line 7).

0

I need a bit more information. What is "RocksLeft" suppose to be? Also, there's no point in using :WaitForChild("Points") in line 7 because if line 5 worked, "Points" has already been found.