generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Scripting Help!

Previous Thread :: Next Thread 
Vyway is not online. 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 is not online. pullman45
Joined: 09 Jul 2012
Total Posts: 2891
11 Aug 2016 09:55 PM
You didn't define player.
Report Abuse
iYzarky is not online. 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 is not online. 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 is not online. 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 is not online. pullman45
Joined: 09 Jul 2012
Total Posts: 2891
11 Aug 2016 09:59 PM
@iYzarky

It can't be a LocalScript..
Report Abuse
pullman45 is not online. 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 is not online. 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 is not online. Vyway
Joined: 28 Jul 2016
Total Posts: 18
12 Aug 2016 09:00 AM
Thank you everyone!
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image