-
What do you want to achieve?
GUI becomes visible when accessory is equipped -
What is the issue?
The rest of the script is working but the GUI part isnt -
What solutions have you tried so far?
I tried modifying the script while referencing other scripts i made
here is the script
local ServerStorage = game:GetService("ServerStorage")
local RealHats = ServerStorage.RealHats:GetChildren() local FakeHats = workspace:WaitForChild("FakeHats"):GetChildren() -- References the "FakeHats" folder inside of the Workspace and turns it into a table that can be looped through so every item does not need to be referenced manually
local function GiveHat(player, FakeHat) --
local Character = player.Character or player.CharacterAdded:Wait()
local HatCheck = Character:FindFirstChild(FakeHat.Name)
local Humanoid = Character:WaitForChild("Humanoid")
local ColorWheel = FakeHat:FindFirstChild("ColorWheel")
if not HatCheck then
for i, RealHat in pairs(RealHats) do
if FakeHat.Name == RealHat.Name then
local ClonedHat = RealHat:Clone()
Humanoid:AddAccessory(ClonedHat)
if ColorWheel then
local clonedColorWheel = ColorWheel:Clone()
clonedColorWheel.Parent = game.StarterGui.ClothesGui
clonedColorWheel.Visible = true
end
end
end
end
end
for i, FakeHat in pairs(FakeHats) do
local Handle = FakeHat:FindFirstChild("Handle")
local ClickDetector = Handle:FindFirstChildOfClass("ClickDetector")
if Handle and ClickDetector then
ClickDetector.MouseClick:Connect(function(player)
GiveHat(player, FakeHat)
end)
end
this script basically equips an accessory on you if you click on the accessory you want to equip. In conclusion , I wanted it so that if you equip an accessory a gui template inside of the fakehat gets cloned and becomes visible. So the problem is that the gui wont showup on my screen.
(im sorry if this is unclear, english isnt my first language)