|
| 11 Dec 2016 04:25 AM |
Hey Guys,
I have a problem with a Script. I want to make the Parts Material to Neon when a Player touches it. But it works only on 1 Part, I want them working on all when a Player step on it.
The place:
https://www.roblox.com/games/569296834/HexagonCodes-Place-Number-280
The Code:
function onTouched(part)
while true do script.Parent.Union.Material = ("Neon") wait(1) script.Parent.Union.Material = ("SmoothPlastic") wait(0.2) break end end
C = script.Parent.Union.Touched:connect(onTouched)
|
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
|
| 11 Dec 2016 08:53 AM |
script.Parent.Union.Touched:Connect(function(part) script.Parent.Union.Material = ("Neon") wait(1) script.Parent.Union.Material = ("SmoothPlastic") wait(0.2) end)
i'm not any more should not the panda and? |
|
|
| Report Abuse |
|
|
|
| 11 Dec 2016 08:55 AM |
for i, v in pairs(script.Parent:GetChildren()) do if v:isA("UnionOperation") then v.Touched:connect(function() for i, v in pairs(script.Parent:GetChildren()) do if v:isA("UnionOperation") then v.Material = ("Neon") end end wait(1) for i, v in pairs(script.Parent:GetChildren()) do if v:isA("UnionOperation") then v.Material = ("SmoothPlastic") end end end) end end
|
|
|
| Report Abuse |
|
|
|
| 11 Dec 2016 09:48 AM |
@RaulChaser
Not all at once but thank you for your help! Only the Part wich the Player stepped on should get Neon |
|
|
| Report Abuse |
|
|
HlCOM
|
  |
| Joined: 29 Mar 2009 |
| Total Posts: 3332 |
|
|
| 11 Dec 2016 10:17 AM |
for i,v in ipairs (model:GetChildren()) do if v:IsA('UnionOperation') then v.Touched:Connect(function(part) if part.Parent:FindFirstChild('Humanoid') then v.Material = Enum.Material.Neon wait(1) v.Material = Enum.Mateiral.SmoothPlastic end end) end end
http://wiki.roblox.com/?title=Loops |
|
|
| Report Abuse |
|
|
|
| 11 Dec 2016 10:48 AM |
@HlCOM
It works! Thanks for your help. |
|
|
| Report Abuse |
|
|