|
| 07 Jan 2015 12:51 PM |
| Can You Have A Script That Checks If Anyone Is Touching A Brick? And What Would The Script Be? |
|
|
| Report Abuse |
|
|
|
| 07 Jan 2015 12:54 PM |
inside a brick place a script,
local Par=script.Parent
Par.Touched:connect(function(p) if game.Players:FindFirstChild(p.Parent.Name)~=nil and Par:FindFirstChild(p.Parent.Name)==nil then local val=Instance.new('BoolValue',Par) val.name=p.Parent.Name val.Value=true end end) Par.TouchedEnded:connect(function(p) if game.Players:FindFirstChild(p.Parent.Name)~=nil and Par:FindFirstChild(p.Parent.Name)~=nil then Par:FindFirstChild(p.Parent.Name):Destroy() end end)
now from another script, to check if you are touching you can say:
if part:FindFirstChild(Player.Name)~=nil then touching=true else touching=false end |
|
|
| Report Abuse |
|
|
| |
|
|
| 07 Jan 2015 12:57 PM |
game.Workspace.Part.Touched(function(p) print(p.."is touching the brick") game.Workspace.Part.TouchEnded(function() print(p.."has topped touching") end) end)
Try it!May not work! |
|
|
| Report Abuse |
|
|
|
| 07 Jan 2015 12:58 PM |
| You're a developer, what do you need these guys' help for? |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 07 Jan 2015 12:58 PM |
@teddy
game.Players:GetPlayerFromCharacter(hit.Parent) |
|
|
| Report Abuse |
|
|
|
| 07 Jan 2015 01:02 PM |
| @chimmihc, I almost never use that method, by habit. But thanks for pointing that out. |
|
|
| Report Abuse |
|
|
|
| 07 Jan 2015 01:23 PM |
Thanks And All But Does It Constantly Check If Sombody Is Touching It Or What Because.
I Want It To Constantly Check if The Part Is Being Touched And As Soon As Nobody Is Walking On It The BrickColor Changes To("Really red") |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 07 Jan 2015 01:26 PM |
| I would love to help you but when I pressed the reply button I realized that your method of writing really annoys me |
|
|
| Report Abuse |
|
|
|
| 07 Jan 2015 01:37 PM |
"SamTheDeveloper" Doesnt know how to make an touched function... Ya... Im not helping.
Lrn 2 cod lua m8 |
|
|
| Report Abuse |
|
|
|
| 07 Jan 2015 02:22 PM |
@MrNoobe123, He is learning to code, that is why he is here.
@Sam this autochecks as it is, Im sorry if you do not know how to use the code at hand. |
|
|
| Report Abuse |
|
|