Basically, I have a textbutton in a gui, when you click it there's a localscript inside that teleports you to a random spawn in the map, and when you click again it teleports you back to the lobby. I made the variable to check whether they are in the lobby or not a global variable so it could be used in other scripts, but I just could not figure out how to make it so that when the player is in the lobby (through whether the lobby remote checker was true or false) their health is made to math.huge and they got a bit faster walkspeed. I couldn't apparently do this in the localscript as for FE games you cant change player health through local scripts.
So if I have a localscript that teleports to map and lobby, how do I change the player's health?
finished = true
script.Parent.MouseButton1Click:connect(function()
if finished then
finished = false
if _G.InLobby == true then
for i,v in pairs(game.Workspace:GetChildren()) do
if v.Name == "map" then
local choices = math.random(23)
local chosenSpawn = v:findFirstChild(choices)
wait()
game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = chosenSpawn.CFrame
end
end
wait(2)
_G.InLobby = false
finished = true
else
for i,v in pairs(game.Workspace:GetChildren()) do
if v.Name == "Lobby" then
local choices = math.random(4)
local chosenSpawn = v:findFirstChild(choices)
wait()
game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = chosenSpawn.CFrame
end
end
wait(2)
_G.InLobby = true
finished = true
end
end
end)
I need to find out how to change the player's health to infinite when _G.InLobby is true and when to make the player's health normal when it's false, how would I do this?
