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

How do I embed this condition that uses a property into my script?

Asked by 7 years ago
Edited by OldPalHappy 7 years ago
target = CFrame.new(-222, 1, 130) 

for i, player in ipairs(game.Players:GetChildren()) do  -- By the amount of players it pairs
   --Make sure the character exists and its HumanoidRootPart exists
   if player.Character and player.Character:FindFirstChild("HumanoidRootPart") and **game.StarterGui.ScreenGui.TextButton.Visible = false** then 

      player.Character.HumanoidRootPart.CFrame = target

   end
end

The bold bit is the one thing that doesn't work. All the other conditions are correct, however whenever I put the game.StartGui.ScreenGui.TextButton.Visible = false, then it doesn't work.

Any ideas on how I can embed that condition into my script? I'd be really grateful for any help.

0
Thanks for the answer, dude! Shadi432 69 — 7y

1 answer

Log in to vote
0
Answered by
cabbler 1942 Moderation Voter
7 years ago

Use == to make a comparison. Also, StarterGui is not meant to change, so try PlayerGui. It might not work either.

player.PlayerGui.ScreenGui.TextButton.Visible == false
Ad

Answer this question