How do I go about making this last bit work in a script, it's supposed to make certain parts invisible whenever I equip my tool, and make them visible on unequip. Right now it doesnt do anything on equip or unequip.
local sp = Script.Parent
sp.Equipped:connect(function()
local SheatheLocation = game.Players.LocalPlayer.Character:FindFirstChild("DaggerBelt")
local SheatheParts = SheatheLocation:GetChildren()
for i = 1, #SheatheParts do
if SheatheParts[i].Name ~= "Middle" then
if SheatheParts[i].Name ~= "Sheathe" then
SheatheParts[i].Transparency = 1
end
end
end
end)
sp.Unequipped:connect(function()
local SheatheLocation = sp.Parent.Parent.Character:FindFirstChild("DaggerBelt")
local SheatheParts = SheatheLocation:GetChildren()
for i = 1, #SheatheParts do
if SheatheParts[i].Name ~= "Middle" then
if SheatheParts[i].Name ~= "Sheathe" then
SheatheParts[i].Transparency = 0
end
end
end
end)
Cheers!

2 comments
good start would be "sp = script.Parent" and not "sp = Script.Parent"
yea