Hi everybody
I’m coming across the following issue
I have a tool that when clicked, is supposed to equip the player with an accessory looks like fire burning on top of the player’s head, and also another accessory that lights up the player’s eyes.
For the game i’m developing, i need those accessories in multiple colored variants, and different tools that each give the player a different colored accessory.
The problem is, Since i’ve created multiple colored variants of the “burning” accessory and “glowing eyes” accessory, i had to place them in ReplicatedStorage for each tool’s script to work.
The issue that occurs is that instead of equipping the player with the accessories of specific color determined by the tool’s script, the tool is equipping the player with EVERY SINGLE accessory that is placed in ReplicatedStorage, causing the effect to look like a multicolored mess and not work as intended.
Here’s the tool script for the green variant:
local ISEquipped = false
local Accessory = game.ReplicatedStorage:WaitForChild(“GreenFireHead”)
script.Parent.Equipped:Connect(function()
ISEquipped = true
end)
script.Parent.Unequipped:Connect(function()
ISEquipped = false
end)
script.Parent.RemoteEvent.OnServerEvent:Connect(function(plr)
if plr.Character:WaitForChild(“Humanoid”) then
if plr.Character:FindFirstChild(“a”) == nil then
Accessory:Clone().Parent = plr.Character
end
end
end)
local ISEquipped = false
local Accessory = game.ReplicatedStorage:WaitForChild(“GreenFireEyes”)
script.Parent.Equipped:Connect(function()
ISEquipped = true
end)
script.Parent.Unequipped:Connect(function()
ISEquipped = false
end)
script.Parent.RemoteEvent.OnServerEvent:Connect(function(plr)
if plr.Character:WaitForChild(“Humanoid”) then
if plr.Character:FindFirstChild(“a”) == nil then
Accessory:Clone().Parent = plr.Character
end
end
end)
Those are two separate scripts, as stated previously.
What am i doing wrong? Why is the game equipping every single color in replicatedstorage instead of just the one i specified?