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