I am attempting to make a script that adds a hat to the players charcater depending on their last play through. I currently have the value of the currentequippedhat set to 1 as default so it is not a data issue. I get the "not functioning" option in the output instead of printing whats inside the first if statement. What do you guys suggest?
local equipEvent = game:GetService("ReplicatedStorage").RemoteEvents.EquipHat
local BasicFedora = game:GetService("ReplicatedStorage"):WaitForChild("Items").Hats.BasicFedora
local BlackStripedFedora = game:GetService("ReplicatedStorage"):WaitForChild("Items").Hats.BlackStripedFedora
local GreenFedora = game:GetService("ReplicatedStorage"):WaitForChild("Items").Hats.GreenFedora
local FancyFedora = game:GetService("ReplicatedStorage"):WaitForChild("Items").Hats.FancyFedora
local BaseballCap = game:GetService("ReplicatedStorage"):WaitForChild("Items").Hats.BaseballCap
game:GetService("Players").PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
if player:WaitForChild("leaderstats"):WaitForChild("PlayerStats").CurrentEquippedHat.Value == 1 then
print("Hat 1 is equipped")
char.Humanoid:RemoveAccessories()
char.Humanoid:AddAccessory(BasicFedora:Clone())
else
print("not functioning")
end
end)
end)

2 comments
-1 , a constant hat isn't going to help at all in the case of a saving and loading hat load system.
no need to be rude and down vote the question ;-;