Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Why do my arms disappear when I reset?

Asked by 8 years ago

I made a script to show your arms while in first person. Why do they disappear when I reset? Here is the script:


local self,player = script.Parent,game.Players.LocalPlayer local char = player.Character or player.CharacterAdded:wait() local humanoid = char:WaitForChild("Humanoid") function antiTrans(part) if part and part:IsA("BasePart") and( part.Name=="Left Arm" or part.Name=="Right Arm") then part.LocalTransparencyModifier = part.Transparency part.Changed:connect(function (property) part.LocalTransparencyModifier = part.Transparency end) end end for _,v in pairs(char:GetChildren()) do antiTrans(v) end

2 answers

Log in to vote
2
Answered by 8 years ago

So basically, you need to add some more connections and event listeners in your script. To do this your going to have convert from a LocalScript to a ServerScript(or regular script in broad terms.)

The main reason it only works once, is because you don't have an event for when the character respawns. This can be done by using Character Added. This fires the even every time character respawn. To use this event, you need to redefine player in a different way because this can't be used in local scripts. So essentially this how it should be.

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(char)
            local humanoid = char:WaitForChild("Humanoid")
        for i,part in pairs(char:GetChildren()) do
        if part and part:IsA("BasePart") and( part.Name=="Left Arm" or part.Name=="Right Arm") then
             part.LocalTransparencyModifier = part.Transparency
                      part.Changed:connect(function(property)
                        part.LocalTransparencyModifier = part.Transparency

                end)
            end
        end
    end)
end)
Ad
Log in to vote
1
Answered by 8 years ago

qwertyuiopasdfghjklzxcvbnm1234567890

Answer this question