Nenno
|
  |
| Joined: 14 Oct 2009 |
| Total Posts: 9208 |
|
|
| 05 Jul 2015 05:52 AM |
local adminDoor = script.Parent
function onTouched(part) if game.Players.Player.Name = ("Nenno") then adminDoor.CanCollide = false else adminDoor.CanCollide = true end end
adminDoor.Touched:connect(onTouched)
Something is wrong with it. Can you guys help me? I'm new to scripting. |
|
|
| Report Abuse |
|
|
Nenno
|
  |
| Joined: 14 Oct 2009 |
| Total Posts: 9208 |
|
| |
|
Nenno
|
  |
| Joined: 14 Oct 2009 |
| Total Posts: 9208 |
|
| |
|
|
| 05 Jul 2015 06:38 AM |
local adminDoor = script.Parent
script.Parent.Touched:connect(function(hit) if hit.Name = ("Nenno") then adminDoor.CanCollide = false else hit:FindFirstChild("Humanoid").Health = 0 adminDoor.CanCollide = true end end) |
|
|
| Report Abuse |
|
|
Nenno
|
  |
| Joined: 14 Oct 2009 |
| Total Posts: 9208 |
|
|
| 05 Jul 2015 06:40 AM |
@fearless
Thank you you magnificent bastard. Can you direct me to a wiki article that explains the hit function? |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2015 06:41 AM |
Yea sure buddy :D
http://wiki.roblox.com/index.php?title=Basic_Scripting |
|
|
| Report Abuse |
|
|
Nenno
|
  |
| Joined: 14 Oct 2009 |
| Total Posts: 9208 |
|
|
| 05 Jul 2015 06:42 AM |
Oh, it encountered a problem
13:41:18.575 - Workspace.AdminDoor.Script:6: 'then' expected near '=' |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2015 06:43 AM |
script.Parent.Touched:connect(function(hit) if hit.Name == ("Nenno") then adminDoor.CanCollide = false else hit:FindFirstChild("Humanoid").Health = 0 adminDoor.CanCollide = true end end)
-- Forgot the double = with if my bad :P |
|
|
| Report Abuse |
|
|
Nenno
|
  |
| Joined: 14 Oct 2009 |
| Total Posts: 9208 |
|
|
| 05 Jul 2015 06:44 AM |
| Okay, thanks. Now I can make an obby with the boost panel and lava scripts I made (my first attempt at scripting. |
|
|
| Report Abuse |
|
|
| |
|
Nenno
|
  |
| Joined: 14 Oct 2009 |
| Total Posts: 9208 |
|
|
| 05 Jul 2015 06:52 AM |
I had to edit the script a bit to make it work.
local adminDoor = script.Parent
script.Parent.Touched:connect(function(hit) if hit.Parent.Name == ("Nenno") then adminDoor.CanCollide = false else game.Workspace.Player.Humanoid.Health = 0 end end)
But thanks for making me realise that the hit function is useful in so many ways. |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2015 06:54 AM |
game.Workspace.Player.Humanoid.Health = 0
This wouldn't work so use
hit.Parent:FindFirstChild('Humanoid').Health = 0 -- :P |
|
|
| Report Abuse |
|
|
Nenno
|
  |
| Joined: 14 Oct 2009 |
| Total Posts: 9208 |
|
|
| 05 Jul 2015 07:06 AM |
| But it worked, I got killed on my alt. I just want to start off with simple scripts. |
|
|
| Report Abuse |
|
|
| |
|