part.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
player.Character:FindFirstChild("Left Arm2").Transparency = 0
end
end)
local pdb = false
local function Touched(Hit)
if not pdb then
pdb=true
local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)
if not Player then return 0 end
Player.Character["Left Arm2"].Transparency = 0
wait(0.1)
pdb = false -- add a debounce because the event fires every millisecond
end
end
script.Parent.Touched:Connect(Touched)
A debounce is not needed because once the part transparency is 0, setting it to 0 won’t change anything, but it’s still more efficient so it won’t run the function multiple times.
I feel like its easier to not use a StarterCharacter and just Insert the Left Arm2 to the left arm Location when the part is touched. But I dont know how to instert a part on the arms location with the same size as the arm
What the…
Alright fine. I’ll make the neatest code in the world.
print("Code online")
local Part = script.Parent
Part.Touched:Connect(function(Hit)
print("Part touched")
local Player = game:GetService("Players"):GetPlayerFromCharacter(Hit.Parent)
if Player then
local Arm = Player.Character:FindFirstChild("Left Arm2") or Player.Character:FindFirstChild("Left Arm2 ") or Player.Character:FindFirstChild(" Left Arm2")
if Arm then
Arm.Transparency = 0
else
print("No arm found")
end
else
print("A PLAYER DIDN'T TOUCH THE PART? WHAT THE HECK?")
end
end)
Tell me if it prints, no need for a yt vid or something like that