local badgeId = 242823687
game.Players.PlayerAdded:connect(function(player)
local moneyStorage = game:GetService("ServerStorage"):WaitForChild("MoneyStorage")
if moneyStorage then
print("1")
local playerStorage = moneyStorage:WaitForChild(player.Name)
if playerStorage then
print("2")
local ownsTycoon = playerStorage:WaitForChild("OwnsTycoon")
if ownsTycoon then
print("3")
repeat wait() until ownsTycoon.Value == true
print("4")
if game:GetService("BadgeService"):UserHasBadge(player.userId, badgeId) then
script.Parent.Got.Value = true
end
end
end
end
end)
-- THE CODE BELOW WORKS
script.Parent.Got.Changed:connect(function(value)
if value == true then
script.Parent.Side1.Transparency = 0
script.Parent.Side2.Transparency = 0
while wait() do
script.Parent.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0,0,0.1)
end
end
end)
I am trying to make something to check if a player has a badge and to check if that player is the owner to the tycoon. There is no output, so I don't know what the problem is. It print 1 2 and 3 but not 4. I have looked and the OwnsTycoon variable DOES change to true, but its not printing 4 when it does

3 comments
what is the setting for ownsTycoon's Value? true or false?
false, when a player touches a door it turns true
maybe you can try using the "if" instead of a repeat.