01 | V = 0 |
02 | function Touched(Plr) |
03 | if game.Players [ Plr.Parent.Name ] ~ = nil then |
04 | V = V+ 1 |
05 | end |
06 |
07 | function Ended(Plr) |
08 | if game.Players [ Plr.Parent.Name ] ~ = nil then |
09 | V = V- 1 |
10 | end |
11 |
12 | script.Parent.Touched:connect(Touched) |
13 | script.Parent.TouchEnded:connect(Ended) |
How do I make it so when it +1 it also adds +1 on a SurfaceGUI text
01 | V = 0 |
02 | function Touched(Plr) |
03 | if game.Players [ Plr.Parent.Name ] ~ = nil then |
04 | V = V+ 1 |
05 | end |
06 |
07 | function Ended(Plr) |
08 | if game.Players [ Plr.Parent.Name ] ~ = nil then |
09 | V = V- 1 |
10 | end |
11 |
12 | script.Parent.Touched:connect(Touched) |
13 | script.Parent.TouchEnded:connect(Ended) |
14 |
15 | local var = 0 |
16 | repeat |
17 | wait( 0.1 ) |
18 | script.Parent.Text = ..V.. --In this case the Script is in a Textbox which is in a SurfaceGUI which is in a part |
19 | until var = = 10 |
I think it might work
01 | V = 0 |
02 | function Touched(Plr) |
03 | if game.Players [ Plr.Parent.Name ] ~ = nil then |
04 | V = V+ 1 |
05 | end |
06 |
07 | function Ended(Plr) |
08 | if game.Players [ Plr.Parent.Name ] ~ = nil then |
09 | V = V- 1 |
10 | end |
11 |
12 | script.Parent.Touched:connect(Touched) |
13 | script.Parent.TouchEnded:connect(Ended) |
14 |
15 | local var = 0 |
I added 2 ends at the bottom and there no prob or bad output, ect.