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

error with NumberValue? [Edited]

The purpose of this code is to run a block of code block. Unfortunately, Nothing happens, no errors. Any ideas on why this doesn't work? Code:

while true do
local plr = game.Players.LocalPlayer
local pack = plr.Backpack
local char = plr.Character
local gooey = plr.PlayerGui
local value = gooey["ToolMain_"].Value1
wait(.00000001)
for p, t in pairs(pack:GetChildren()) do
    if t.ClassName=="Tool" and t.Parent==pack and value.Value == 1 then
        t.Parent = char
    end
end
end

1 comment

0

Well, here

1 answer

Your code:

while true do
local plr = game.Players.LocalPlayer
local pack = plr.Backpack
local char = plr.Character
local gooey = plr.PlayerGui
local value = gooey.ToolMain_.Value
wait(.00000001)
for p, t in pairs(pack:GetChildren()) do
    if t.ClassName=="Tool" and t.Parent==pack and value.Value == 1 then
        t.Parent = char
    end
end
end

fixed code:

while true do
local plr = game.Players.LocalPlayer
local pack = plr.Backpack
local char = plr.Character
local gooey = plr.PlayerGui
local value = gooey["ToolMain_"]
wait(.00000001)
for p, t in pairs(pack:GetChildren()) do
    if t:IsA("Tool") and t.Parent==pack and value.Value == 1 then --Oh and if it doesn't work go ahead and try ClassName.
        t.Parent = char
    end
end
end

9 comments

0

Tell me if it won't work

0

It is not working, i get the fallowing error: 02:29:04.050 - ToolNaub_ is not a valid member of PlayerGui

0

OOps, mistake, Fixed it

0

Still not working as intended, when i change the value from 0 to 1 nothing happens.

0

Any errors?

0

No. None.

0

Go to the script, go to view at top, click script diagnostic, then click on warnings

0

There is no warnings

0

Is the value in ToolMain set to 1?

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