Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 3 years ago

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

Log in to vote
0
Answered by
Manby7 32
3 years ago
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.

Ad

Answer this question