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!
1) make a remoteevent in replicatedstorage, call it equiptoolevent 2) make another remoteevent in replicatedstorage, call it unequiptoolevent 3) put this in your localscript
local equipevent = game.ReplicatedStorage.equiptoolevent local unequipevent = game.ReplicatedStorage.unequiptoolevent sp.Equipped:connect(function() equipevent:FireSever() end) sp.Unequipped:connect(function() unequipevent:FireServer() end)
4) majke a serverscript in serverscriptservice, call it toolscript 5) put this into the script
local equipevent = game.ReplicatedStorage.equiptoolevent local unequipevent = game.ReplicatedStorage.unequiptoolevent equipevent.OnServerEvent:Connect:function(player) --write equip script here end) unequipevent.OnServerEvent:Connect:function(player) ---write equip script here end)
this script fixing another error, other players won't see when the player makes thier tool invisible/visible