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

Can someone help me with a RenderStepped trouble?

Asked by 7 years ago

So...basically i created a tool that makes your arms visible (even in 1st person) while equipped,but i'm having a trouble with it. The RenderStepped event won't disconnect.

This is my first script (local script)


tool=script.Parent tool.Equipped:connect(function() renderStepped=game:GetService('RunService').RenderStepped:connect(function() tool.Parent['Right Arm'].LocalTransparencyModifier=0 tool.Parent['Left Arm'].LocalTransparencyModifier=0 end) end) tool.Unequipped:connect(function() renderStepped:disconnect() end)

then i tried to make a server script fire a remote event when it's unequipped

--Server script

tool=script.Parent
unequip=tool.Unequip

tool.Unequipped:connect(function()
    unequip:FireClient(game.Players:GetPlayerFromCharacter(tool.Parent))
end)

--Local script

tool=script.Parent
unequipEvent=tool.Unequip

tool.Equipped:connect(function()
    renderStepped=game:GetService('RunService').RenderStepped:connect(function()
        tool.Parent['Right Arm'].LocalTransparencyModifier=0
        tool.Parent['Left Arm'].LocalTransparencyModifier=0
    end)
end)

unequipEvent.OnClientEvent:connect(function()
    renderStepped:disconnect()
end)

none of this worked.

0
Try defining the :disconnet function and connection before the renderstepped function WingedHorizen201 124 — 7y
2
RenderStepped only works in a local script. JWBlueLbl 3 — 7y
0
@WingedHorizen201 I don't get it. If i define the disconnect function and the connection BEFORE the RenderStepped,the arms will not show up arthurgps2 67 — 7y
0
Oh, I must have worded it confusingly. What I mean is that you should move the connection for tool.unequip before tool.equip in your local script. WingedHorizen201 124 — 7y
View all comments (2 more)
0
I still don't get it arthurgps2 67 — 7y
0
bump ._. arthurgps2 67 — 7y

Answer this question