GetPropertyChangedSignal() not working

So I made a melee script that lets me add more melees in the future but the transparency is invisible, I don’t know why I have a similar script and it works just fine but this one is broken?

It doesn’t get the GetPropertyChangedSignal()

script:

meleeevt.OnClientEvent:Connect(function(Name)
	coroutine.wrap(meleecooldown)()
	local meleemodel = nil
	if Name ~= "None" then
		
		for i, v in pairs(char["Right Arm"]:GetChildren()) do
			if v.Name == Name then
				meleemodel = v
				
			end
		end
		
		if meleemodel then
			for i, v in pairs(meleemodel:GetDescendants()) do 
				if v:IsA("Part") or v:IsA("MeshPart") or v:IsA("UnionOperation") then
					v:GetPropertyChangedSignal("LocalTransparencyModifier"):Connect(function()
						print(1)
						v.LocalTransparencyModifier = v.Transparency
					end)
				end
			end
		end
	end
end

The similar script in question (both are localscripts):

DrinkEvt.OnClientEvent:Connect(function(drink, perk)
    local perkmodel = nil
    for i, v in pairs(char["Right Arm"]:GetChildren()) do
        if v.Name == drink then
            perkmodel = v
        end

        if perkmodel then
            for i, v in pairs(perkmodel:GetDescendants()) do 
				if v:IsA("Part") or v:IsA("MeshPart") then
					v:GetPropertyChangedSignal("LocalTransparencyModifier"):Connect(function()
						v.LocalTransparencyModifier = v.Transparency
					end)
                end
            end
        end
	end
end)
1 Like

Can you add print statements to your new code to see where it might be going wrong?
Specifically in:

  • the for loop
  • after the check for the part
  • inside the property changed signal

Also, as a bonus tip, you can replace your if statement with this, to apply to all part types:

if v:IsA("BasePart") then
1 Like

I fixed it myself, I just add it to runservice (ps. ‘if v:IsA(“BasePart”) then’ really help, thanks)

(Edited cause I thought this was other thread I’m watching, sorry : P)

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.