Hey devforum, I need some help fixing a problem with tool handles:
After I join the game, or after I die, when I equip a tool for the first time, the handle is invisible, I have to unequip it and equip it again for it to start showing up. After I die or rejoin, it happens again.
https://gyazo.com/4b06848f7f19c6c6d10725ca9234cb51
This is the script I am using to equip the tool:
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local userI = game:GetService("UserInputService")
local tool = script.Parent.Value
userI.InputBegan:Connect(function(input, gameP)
if gameP then return end
if input.KeyCode == Enum.KeyCode.One then
if tool.Parent ~= character then
local insideStuff = character:GetChildren()
for i, v in pairs(insideStuff) do
if v.ClassName == "Tool" then
v.Parent = player.Backpack
end
end
tool.Parent = character
elseif tool.Parent ~= player.Backpack then
tool.Parent = player.Backpack
end
end
end)
script.Parent.Parent.Number1Frame.TextButton.MouseButton1Click:Connect(function()
if tool.Parent ~= character then
local insideStuff = character:GetChildren()
for i, v in pairs(insideStuff) do
if v.ClassName == "Tool" then
v.Parent = player.Backpack
end
end
tool.Parent = character
elseif tool.Parent ~= player.Backpack then
tool.Parent = player.Backpack
end
end)
script.Parent.Value:GetPropertyChangedSignal("Parent"):Connect(function()
if script.Parent.Value.Parent ~= player.Backpack then
script.Parent.Parent.Number1.BackgroundTransparency = 0
script.Parent.Parent.Number1Frame.BackgroundTransparency = 0
else
script.Parent.Parent.Number1.BackgroundTransparency = 0.4
script.Parent.Parent.Number1Frame.BackgroundTransparency = 0.4
end
end)
Thanks for reading!