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

Why is this not printing the intValue? [closed]

Asked by 10 years ago

sorry if i posted the same post twice but making this in code block might help its not showing errors in the output and its not showing on my gui button

CanVote = Workspace.canVote
CanVote.Value=true
Map1=Workspace.Deathrun
Map2=Workspace.FFA
 function Clicked()
     if CanVote.Value==true then
    for i=1,1 do
      Map1.Value=Map1.Value+1
    end
    if Map2.Value>0 then
        for i=1,1 do
     Map2.Value=Map2.Value-1
      end
    end
    votes=script.Parent
    votes.Text=("Deathrun   Vote:"..Map1.Value)
    wait(10)
        CanVote.Value=false
end
if CanVote.Value == false then return end
 print("2") 
end
script.Parent.MouseButton1Click:connect(Clicked)
0
You know you can edit a post, right? GoldenPhysics 474 — 10y
0
sorry i am such a noob threatboy101 2 — 10y
0
Anyways, your problem is on lines 18 and 20. You set CanVote.Value to false, then if CanVote.Value equals false (it does) then exit and don't execute anything else in the function. Therefore the print statement is not executed. GoldenPhysics 474 — 10y
0
it prints 2 though threatboy101 2 — 10y
0
please help threatboy101 2 — 10y

Locked by TheMyrco

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

1 answer

Log in to vote
0
Answered by 10 years ago

When I ran mine which is basicly like yours it never printed 2. As golden said you need to make the CanVote.Value=true. Also I see that you use for i=1 which just runs it once. I don't think you need them...

0
it has to run once because i dont want it adding values and it prevents glitches threatboy101 2 — 10y
0
I meant you could just simple remove the i=1 and then end with it and it would only run once. I think at least sorry if i'm wrong. GetSporked 5 — 10y
Ad