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

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

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.

1 comment

0

Thanks for the answer, dude!

1 answer

✓ Accepted answer

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

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