|
| 03 Jan 2012 07:39 PM |
Heres my script: local user = "monkey1589" -- the player's username local badgeId = 59719865 -- the shirt's assetId local door = script.Parent function onTouched(hit) local player = game:GetService'Players':GetPlayerFromCharacter(hit.Parent) or game:GetService'Players':GetPlayerFromCharacter(hit.Parent) if player and player.Character and (player.Name:lower() == user:lower() or game:GetService'BadgeService':UserHasBadge(badgeId)) then local anchoredState = door.Anchored -- remember anchored local transparencyState = door.Transparency -- remember transparency door.Anchored = true door.CanCollide = false door.Transparency = 0.5 wait(4) door.CanCollide = true door.Anchored = anchoredState -- make it anchored like before door.Transparency = transparencyState -- make it transparent like before else player.Character:BreakJoints() end end door.Touched:connect(onTouched)
Heres my output: 18:36:47 - Argument 2 missing or nil 18:36:47 - Script "Workspace.door.Script", Line 9 18:36:47 - stack end
This is line 9: if player and player.Character and (player.Name:lower() == user:lower() or game:GetService'BadgeService':UserHasBadge(badgeId)) then |
|
|
| Report Abuse |
|
|
|
| 03 Jan 2012 07:44 PM |
You forgot parantheses.
game:GetService('BadgeService') |
|
|
| Report Abuse |
|
|
|
| 03 Jan 2012 07:44 PM |
Replace line 9 with this: if player and player.Character and (player.Name:lower() == user:lower() or game:GetService'BadgeService':UserHasBadge(player.userId, badgeId)) then |
|
|
| Report Abuse |
|
|
|
| 03 Jan 2012 07:45 PM |
| Thanks. Your both awesome. I'll try it out |
|
|
| Report Abuse |
|
|
|
| 03 Jan 2012 07:47 PM |
@theblob
No. You also forgot parantheses. This is the fully edited line 9: (Replace line 9 with this)
if player and player.Character and (player.Name:lower() == user:lower() or game:GetService('BadgeService'):UserHasBadge(player.userId, badgeId)) then |
|
|
| Report Abuse |
|
|
|
| 03 Jan 2012 07:49 PM |
Output says this now: 18:48:15 - Workspace.door.Script:23: attempt to index local 'player' (a nil value) 18:48:15 - Script "Workspace.door.Script", Line 23 18:48:15 - stack end
Line 23 is this: player.Character.Humanoid.Health = 0 |
|
|
| Report Abuse |
|
|
|
| 03 Jan 2012 07:51 PM |
Dude, you need to replace all your GetService'Service' with GetService('Service')
GetService requires parantheses. |
|
|
| Report Abuse |
|
|
|
| 03 Jan 2012 07:52 PM |
| And also, your sxcript is very inefficient. Why are you 'remembering' the anchored and transparency like before??? Setting them manually is much quicker. |
|
|
| Report Abuse |
|
|
| |
|
|
| 03 Jan 2012 08:43 PM |
Don't listen to him, the way you have it is perfectly fine. all you need to do is change the else in line 22 to:
elseif player and player.Character then
Also you should delete this: or game:GetService'Players':GetPlayerFromCharacter(hit.Parent) in line 7 because it is useless. Your new line 7 should look like this: local player = game:GetService'Players':GetPlayerFromCharacter(hit.Parent) |
|
|
| Report Abuse |
|
|