Vyway
|
  |
| Joined: 28 Jul 2016 |
| Total Posts: 18 |
|
|
| 11 Aug 2016 09:51 PM |
I can't seem to figure out what the problem is, here is my code:
function onPlayerEntered(player) player.CharacterAdded:connect(function() for _, controller in pairs(game:GetService("ControllerService"):GetChildren()) do controller.Parent = nil end local cammanip = game.Workspace.CameraManipulation:Clone() cammanip.Parent = player.PlayerGUI cammanip.Disabled = false local camcont = game.Workspace.CameraControls:Clone() camcont.Parent = player.PlayerGUI camcont.Disabled = false player.Character.Humanoid.WalkSpeed = 0 for i = 1, #player.Character:GetChildren() do local b = player.Character:GetChildren()[i] if b.ClassName == "Part" then b.Transparency = 1 elseif b.ClassName == "Hat" then b:Destroy() end end player.Character.Torso.Position = game.Workspace.PlayerBox.PlayerSpawn.Position end) end
game.Players.PlayerAdded:connect(onPlayerEntered())
The output says: 22:46:52.665 - Workspace.PlayerEntered:2: attempt to index local 'player' (a nil value)
Please help! |
|
|
| Report Abuse |
|
|
pullman45
|
  |
| Joined: 09 Jul 2012 |
| Total Posts: 2891 |
|
| |
|
iYzarky
|
  |
| Joined: 01 Jun 2009 |
| Total Posts: 1271 |
|
|
| 11 Aug 2016 09:57 PM |
if local script player = game.Players.LocalPlayer
I don't even care humImie |
|
|
| Report Abuse |
|
|
pullman45
|
  |
| Joined: 09 Jul 2012 |
| Total Posts: 2891 |
|
|
| 11 Aug 2016 09:57 PM |
Do this btw:
game.Players.PlayerAdded:connect(function(player)
end)
Or in your case:
game.Players.PlayerAdded:connect(onPlayerEnterd(player)) |
|
|
| Report Abuse |
|
|
lolb3
|
  |
| Joined: 16 Jan 2010 |
| Total Posts: 2268 |
|
|
| 11 Aug 2016 09:58 PM |
game.Players.PlayerAdded:connect(onPlayerEntered)
You want to pass the function itself, not what the function returns. |
|
|
| Report Abuse |
|
|
pullman45
|
  |
| Joined: 09 Jul 2012 |
| Total Posts: 2891 |
|
|
| 11 Aug 2016 09:59 PM |
@iYzarky
It can't be a LocalScript.. |
|
|
| Report Abuse |
|
|
pullman45
|
  |
| Joined: 09 Jul 2012 |
| Total Posts: 2891 |
|
|
| 11 Aug 2016 10:00 PM |
@my last post
I didn't mean that second period... |
|
|
| Report Abuse |
|
|
iYzarky
|
  |
| Joined: 01 Jun 2009 |
| Total Posts: 1271 |
|
|
| 11 Aug 2016 10:01 PM |
Sorry didn't read the script, hopped on the forums just to take a look, read the player wasn't defined and just assumed, sorry!
I don't even care humImie |
|
|
| Report Abuse |
|
|
Vyway
|
  |
| Joined: 28 Jul 2016 |
| Total Posts: 18 |
|
| |
|