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

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

Asked by
Dr_Doge 100
10 years ago

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


0
By your title "not totally" I'm guessing part of it works, please say what works and what doesn't. Vividex 162 — 10y

2 answers

Log in to vote
0
Answered by 10 years ago

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)

0
try this Game.Workspace.Game1.Players.Value.Value -- fi you did not remame the propety User#5423 17 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

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) 
0
change the numbers to please yourself rollercoaster57 65 — 10y

Answer this question