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

Why is this not printing the intValue?

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)

5 comments

0

You know you can edit a post, right?

0

sorry i am such a noob

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.

0

it prints 2 though

0

please help

1 answer

✓ Accepted answer

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...

2 comments

0

it has to run once because i dont want it adding values and it prevents glitches

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.

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