Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

No errors when script is happening but script isn't changing the value working?

I made a script but has no error, it should work i'm pretty sure

while true do
	wait(1)
	local TheName = script.User.Value -- The users name
	if game.Players:FindFirstChild(TheName) and workspace:FindFirstChild(TheName):IsA("Model") and workspace:FindFirstChild(TheName) then
		if game.Players:FindFirstChild(TheName).PerkValues.DoubledMoneyIs.Value == true then
		    script.Parent.Value = 2 -- Should change value to 2 but doesn't
	    end	
	    if game.Players:FindFirstChild(TheName).PerkValues.DoubledMoneyIs.Value == false then
		    script.Parent.Value = 1 -- if doubled money value is false then it should change back to 1
	    end	
	end	
end

1 answer

while true do
02	    wait(1)
03	    local TheName = script.User.Value -- The users name
04	    if game.Players:FindFirstChild(TheName) and workspace:FindFirstChild(TheName):IsA("Model") and workspace:FindFirstChild(TheName) then
05	        if game.Players:FindFirstChild(TheName).PerkValues.DoubledMoneyIs.Value == true then              -- First thing you want to do is make sure that the script actually made it to this part in the code.   
print("True")
06	            script.Parent.Value = 2 -- Should change value to 2 but doesn't
07	        end
08	        if game.Players:FindFirstChild(TheName).PerkValues.DoubledMoneyIs.Value == false then
09	            script.Parent.Value = 1 -- if doubled money value is false then it should change back to                 print("False")
10	        end
11	    end
12	end

Tell me if it printed! if it didn't, its because it never made it into that part of the script.

This discussion is preserved as it was. New answers, comments, and votes are closed.