|
| 06 Jul 2017 11:02 PM |
ok so i cant figure out why this wont work, im trying to change the transparency when the tool is activated, but it wont work, if tried every debugging method i know but i cant figure it out
tool = script.Parent handle = tool.Handle uppertorso = game.Players.LocalPlayer.Character.UpperTorso tool.Activated:connect(function() if uppertorso.Transparency == 0 then print("it got to line 6") uppertorso.Transparency = 0.5 print("it got paste changing the transparency") else uppertorso.Transparency = 0 end end) |
|
|
| Report Abuse |
|
|
|
| 06 Jul 2017 11:03 PM |
| lmao mis spelled past on the print |
|
|
| Report Abuse |
|
|
|
| 06 Jul 2017 11:04 PM |
tool = script.Parent handle = tool.Handle uppertorso = game.Players.LocalPlayer.Character.Torso tool.Activated:connect(function() if uppertorso.Transparency == 0 then print("it got to line 6") uppertorso.Transparency = 0.5 print("it got paste changing the transparency") else uppertorso.Transparency = 0 end end)
that oughta work |
|
|
| Report Abuse |
|
|
|
| 06 Jul 2017 11:06 PM |
@Coder, he is probably using R15. I'd imagine if it had to be Torso instead of UpperTorso, he would have caught that error already.
Are you using a LocalScript? What sort of output are you getting? |
|
|
| Report Abuse |
|
|
|
| 06 Jul 2017 11:08 PM |
| yes im using r15, and im not getting any errors in the output and yes im using localscript |
|
|
| Report Abuse |
|
|
|
| 06 Jul 2017 11:08 PM |
I read something in a wiki about the transparency's aren't actually exactly 0 and is about .0333+
Maybe find a different way to check it? Have a number value that gets set by whatever is changing the transparency. |
|
|
| Report Abuse |
|
|
|
| 06 Jul 2017 11:11 PM |
| tried printing to see if it was anything else, didnt work, usally does in past experience |
|
|
| Report Abuse |
|
|
|
| 06 Jul 2017 11:18 PM |
It might not be the immediate fix, but if you define your variable for the UpperTorso outside of the event, won't this value be nullified when the character dies/respawns? Try indexing the UpperTorso within the Activated event:
uppertorso = tool.Parent:FindFirstChild("UpperTorso") |
|
|
| Report Abuse |
|
|
|
| 06 Jul 2017 11:19 PM |
| use :WaitForChild() just to be sure ;) |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2017 10:24 AM |
| sorry for such late reply, but thanks, yall helped me figured it out, since the script is loading faster than my character can load, its making the variable nil, so i just put the variable into the function |
|
|
| Report Abuse |
|
|