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

When I add "if script.Parent.Start.Value == true" The script breaks, Why is this happening?

I want my script to run when script.Parent.Start.Value == true but it dosen't work? I don't understand why. I tripple checked and script.Parent.Start.Value is vaild it's just the script that won't work. Can someone help me?

local minutes = 4
local seconds = 0
local hours = 0
local h = script.Parent
if script.Parent.Start.Value == true then -- When I add this line the whole script breaks, even if Start.Value == true why?
h.Parent = game.Workspace                 -- When I remove line 5 the code works just fine
for i = 1, (hours+1) do
for i = 1, (minutes+1) do
for i = 1, (seconds+1) do
if hours < 10 then
     if minutes < 10 then
            if seconds < 10 then
            h.Value = ""..minutes..":0"..seconds
            else
            h.Value = ""..minutes..":"..seconds
            end
     else
             if seconds < 10 then
             h.Value = ""..minutes..":0"..seconds
             else
             h.Value = ""..minutes..":"..seconds
             end
     end
else
     if minutes < 10 then
            if seconds < 10 then
            h.Value = ""..minutes..":0"..seconds
            else
            h.Value = ""..minutes..":"..seconds
            end
     else
             if seconds < 10 then
             h.Value = ""..minutes..":0"..seconds
             else
             h.Value = ""..minutes..":"..seconds
             end
     end
end
seconds = seconds - 1
wait(1)
end
seconds = 59
minutes = minutes - 1
end
minutes = 59
seconds = 59
hours = hours - 1
end
   end

1 answer

That one line is basically telling the entire script, hey check if this value is true; if not then don't run anything under it. The script will only check if the value is true once if it is not it will not run any code below it. Meaning if the value hasn't loaded yet it is nil, if u changed the value after the script ran it was false when u ran the script, then u changed it after it checked.

1 comment

0

Yes, but even when the value is set to "true" the code doesn't run. That's where I'm conflicted at.

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