generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Game Design
Home Search
 

Re: Help

Previous Thread :: Next Thread 
ElectoStriking is not online. ElectoStriking
Joined: 10 May 2014
Total Posts: 1547
07 Oct 2015 02:07 PM
so im a novice scripter and this script wont work and i know why but dont know how to fix it:

script.Parent.ClickDetector.MouseClick:connect(function(hit)
hit.torso.Transparency=0.5
hit.Head.Transparency=0.5
hit["Left Leg"].Transparency=0.5
hit["Right Leg"].Transparency=0.5
hit["Right Arm"].Transparency=0.5
hit["Left Arm"].Transparency=0.5
end)

so i know that the player(hit) doesn't store the body parts but how would i find the body parts then. Sorry as this seems like a basic question but im just a little stuck. Any ideas?
Report Abuse
RoKjell is not online. RoKjell
Joined: 22 Nov 2012
Total Posts: 1205
07 Oct 2015 02:23 PM
hit in this case, is your player, so if you'd print hit.name, you would get his name. You have to find the character from that player and then go to the parts you need, or to make it easy, change everything that "IsA" Part, which only uses 1 line instead of 6 for all his body parts.

You could make it a local script and use this:

local player = game.Players.LocalPlayer
if player.Character then
player.Character:GetChildren():IsA("Part").Transparency = 0.5
end

--If player.Character:GetChildren():IsA("Part").Transparency = 0.5 doesn't work, use your method instead, I didn't test it and never had to use it before.



Why? Because I can.
Report Abuse
ElectoStriking is not online. ElectoStriking
Joined: 10 May 2014
Total Posts: 1547
07 Oct 2015 02:25 PM
ok thx a bunch
Report Abuse
championbuilder is not online. championbuilder
Joined: 20 Jan 2009
Total Posts: 13544
07 Oct 2015 02:27 PM
You're checking if a table is a part. gg.
Report Abuse
RoKjell is not online. RoKjell
Joined: 22 Nov 2012
Total Posts: 1205
07 Oct 2015 02:31 PM
That's why I said it might not work XD I never tried that



Why? Because I can.
Report Abuse
championbuilder is not online. championbuilder
Joined: 20 Jan 2009
Total Posts: 13544
07 Oct 2015 02:32 PM
You want to loop through the table.

script.Parent.ClickDetector.MouseClick:connect(function(hit)
for _,v in pairs(hit.Parent:GetChildren()) do --This loops through every child in hit.Parent, and checks if "v" is a part.
if v:IsA'BasePart' then
v.Transparency = 0.5
end
end
end)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Game Design
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image