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

Thanks! Answered! Why is this GUI button not totally working?

The button teleports, but dose not change the numplaying value! Also the script wont teleport the player back to spawn with full health when he/she has 30 or lower health!

Dose someone have a fix?

function MouseClick()
    wait(0)
    local numplaying = Game.Workspace.Game1.Players.Value;
    if numplaying == 0 or numplaying == 1 then


script.Parent.Parent.Parent.Parent.Character.Torso.CFrame = CFrame.new(19.6, 4.6, -27.6)
wait(0)
numplaying = (numplaying+1)



end
end

script.Parent.MouseButton1Down:connect(MouseClick)

local Health = script.Parent.Parent.Parent.Parent.Character.Humanoid.Health

if Health <=30 then

script.Parent.Parent.Parent.Parent.Character.Humanoid.Health= "100"
script.Parent.Parent.Parent.Parent.Character.Torso.CFrame = CFrame.new(99.23, 149.962, -2.248)



end


1 comment

0

By your title "not totally" I'm guessing part of it works, please say what works and what doesn't.

2 answers

try this:- Also have you got filtering enabled?

function MouseClick()
    wait(0)
    local numplaying = Game.Workspace.Game1.Players.Value
    if numplaying == 0 or numplaying == 1 then


script.Parent.Parent.Parent.Parent.Character.Torso.CFrame = CFrame.new(19.6, 4.6, -27.6)
wait(0)
numplaying = (numplaying+1)

end

local Health = script.Parent.Parent.Parent.Parent.Character.Humanoid.Health

if Health <=30 then

Health= 100
script.Parent.Parent.Parent.Parent.Character.Torso.CFrame = CFrame.new(99.23, 149.962, -2.248)

end

script.Parent.MouseButton1Down:connect(MouseClick)

1 comment

0

try this Game.Workspace.Game1.Players.Value.Value -- fi you did not remame the propety

This should work...

function MouseClick(player) 
    local numplaying = Game.Workspace.Game1.Players.Value; 
  if numplaying == 0 or numplaying == 1 then 
player.Torso.CFrame = CFrame.new(19.6, 4.6, -27.6) 
numplaying = (numplaying+1) 
end
local Health =player.Humanoid.Health 
if Health <=30 then
player.Humanoid.Health= "100" 
player.Torso.CFrame = CFrame.new(99.23, 149.962, -2.248)
end 
end
script.Parent.MouseButton1Down:connect(MouseClick) 

1 comment

0

change the numbers to please yourself

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