Hello, so I am trying to see if a player has a Halo or not, and when I added this for loop to check for if the player has another halo or the same halo equipped, the if statement doesn't do anything.
-- Local Script
local repStorge = game.ReplicatedStorage
local RE = repStorge:WaitForChild("RemoteEvent")
script.Parent.TextButton.MouseButton1Click:Connect(function()
RE:FireServer("dfds5f4df165fds4f")
end)
-- Server-Script
local repStorge = game.ReplicatedStorage
local RE = repStorge:WaitForChild("RemoteEvent")
game.Players.PlayerAdded:Connect(function(plr)
local EquippedHalos = Instance.new("Folder", plr)
EquippedHalos.Name = "EquippedHalos"
end)
RE.OnServerEvent:Connect(function(plr, key)
if key == "dfds5f4df165fds4f" then
local Halo = game.ServerStorage:WaitForChild("Halo")
local char = plr.Character
local money = plr.leaderstats.Money
local EqHalo = plr:WaitForChild("EquippedHalos")
-- Variable's
local function checkFol() -- This is what I just added, without this it would work perfectly fine
for _, v in pairs(EqHalo:GetChildren()) do
if v then
return true
else
return false
end
end
end
local function checkForHalo()
if char:FindFirstChild("Halo") then
return true
else
return false
end
end
local hasHaloOrNot = checkForHalo()
local hHON = checkFol()
if money.Value >= 100 and hasHaloOrNot == false and hHON == false then
money.Value = money.Value - 100
print("Working!")
local NormalHalo = Instance.new("BoolValue", plr:FindFirstChild("EquippedHalos"))
NormalHalo.Name = "NormalHalo"
local ClonedHalo = Halo:Clone()
ClonedHalo.Parent = char
end
end
end)
Please, if you find a solution, feel free to comment something below. Have a nice rest of your morning/day/night!
