|
| 16 Dec 2016 11:04 PM |
Error: Workspace.Script:3: attempt to index local 'player' (a nil value)
What my script is suppose to do is it's made to make a wall able to walk through if they're an HR. I've tested it a couple times and then it broke.
local player = game.Players.LocalPlayer
if player:GetRankInGroup(2952420) >= 40 then game.Workspace.InvisibleTrainerWall.CanCollide = false end |
|
|
| Report Abuse |
|
|
| |
|
|
| 16 Dec 2016 11:10 PM |
Well, eh after a while don't you want it to close again?? Plus you might have to put a WaitForChild() in there.
local player = game.Players.LocalPlayer local Wall = game.Workspace:WaitForChild("InvisibleTrainerWall")
if player:GetRankInGroup(2952420) >= 40 then Wall.CanCollide = false wait(5) Wall.CanCollide = true end |
|
|
| Report Abuse |
|
|
|
| 16 Dec 2016 11:12 PM |
| omg i put that in a script i used in my other place... |
|
|
| Report Abuse |
|
|
|
| 16 Dec 2016 11:20 PM |
| doesn't work. Still says play is a nil value |
|
|
| Report Abuse |
|
|
| |
|
|
| 16 Dec 2016 11:21 PM |
| What do you mean play? Is that the entire script? |
|
|
| Report Abuse |
|
|
|
| 16 Dec 2016 11:22 PM |
local player = game.Players.LocalPlayer repeat wait() until game.Players.LocalPlayer ~= nil and game.Players.LocalPlayer.Character ~= nil local Wall = game.Workspace:WaitForChild("InvisibleTrainerWall")
if player:GetRankInGroup(2952420) >= 40 then Wall.CanCollide = false wait(5) Wall.CanCollide = true end
|
|
|
| Report Abuse |
|
|
WoolHat
|
  |
| Joined: 19 May 2013 |
| Total Posts: 1873 |
|
|
| 16 Dec 2016 11:27 PM |
| Sounds like you're using a server script. Server scripts cannot access a local player, as they are owned and operated by the server |
|
|
| Report Abuse |
|
|
| |
|
|
| 16 Dec 2016 11:30 PM |
| @Wool I should've known that.. |
|
|
| Report Abuse |
|
|
Astranite
|
  |
| Joined: 01 Dec 2016 |
| Total Posts: 562 |
|
|
| 16 Dec 2016 11:30 PM |
No need for the repeat loop. Quite possible you're using a script as opposed to a LocalScript, as others have mentioned.
|
|
|
| Report Abuse |
|
|
|
| 16 Dec 2016 11:41 PM |
| do you know how to create it from a local script because when I'm doing it, it's not even working. |
|
|
| Report Abuse |
|
|
| |
|