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

SurfaceGUI and Math help?

V=0
function Touched(Plr)
if game.Players[Plr.Parent.Name]~=nil then
V=V+1
end

function Ended(Plr)
if game.Players[Plr.Parent.Name]~=nil then
V=V-1
end

script.Parent.Touched:connect(Touched)
script.Parent.TouchEnded:connect(Ended)

How do I make it so when it +1 it also adds +1 on a SurfaceGUI text

2 answers

V=0
function Touched(Plr)
if game.Players[Plr.Parent.Name]~=nil then
V=V+1
end

function Ended(Plr)
if game.Players[Plr.Parent.Name]~=nil then
V=V-1
end

script.Parent.Touched:connect(Touched)
script.Parent.TouchEnded:connect(Ended)

local var = 0
repeat
wait(0.1)
script.Parent.Text = ..V.. --In this case the Script is in a Textbox which is in a SurfaceGUI which is in a part
until var==10

I think it might work

5 comments

0

If it doesn't work then at the "..V.." try editing the dots to "..V" or "V.." or "..V. " else give me the error the output says and ill try to fix it

0

Dude, Im kinda confused, this is how I have it set up: http://gyazo.com/8f0529876a096ef039221d6a973fd46a (Script is where I have your script in)

0

You con't need "..V.." put simply V.

0

Listen to ultra for that one and then just put the Script inside the Text Label

V=0
function Touched(Plr)
if game.Players[Plr.Parent.Name]~=nil then
V=V+1
end

function Ended(Plr)
if game.Players[Plr.Parent.Name]~=nil then
V=V-1
end

script.Parent.Touched:connect(Touched)
script.Parent.TouchEnded:connect(Ended)

local var = 0
repeat
wait(0.1)
script.Parent.Text = V
until var==10
end
end

I added 2 ends at the bottom and there no prob or bad output, ect.

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