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: Annoying Problem

Previous Thread :: Next Thread 
PastDays is not online. PastDays
Joined: 09 Jan 2011
Total Posts: 732
07 Dec 2016 04:31 PM
Why does this script give this error?

-----------------------------------------------------------
22:29:43.124 - Workspace.Part Counter:3: attempt to index field 'LocalPlayer' (a nil value)
-----------------------------------------------------------
local count = workspace -- The place where to count bricks

local Display = game.Players.LocalPlayer.PlayerGui.FPS.Frame.Amount.Text

function CountBricks()
local c = 0
for i,v in pairs(count:GetChildren()) do
if v:IsA("BasePart") then
c = c + 1
end
end
return c
end

while true do
Display.Text = "There are "..CountBricks().." Bricks."
wait(0.0001)
end


|- PastDays -|
Report Abuse
KritikalGunzz is not online. KritikalGunzz
Joined: 10 Nov 2013
Total Posts: 1633
07 Dec 2016 04:33 PM
Are you running this through a localscript or server script?
Report Abuse
PastDays is not online. PastDays
Joined: 09 Jan 2011
Total Posts: 732
07 Dec 2016 04:35 PM
Normal script (Server script) in workspace


|- PastDays -|
Report Abuse
PastDays is not online. PastDays
Joined: 09 Jan 2011
Total Posts: 732
07 Dec 2016 04:38 PM
Nvm Fixed it


|- PastDays -|
Report Abuse
KritikalGunzz is not online. KritikalGunzz
Joined: 10 Nov 2013
Total Posts: 1633
07 Dec 2016 04:39 PM
You cannot use localplayer inside a serverscript since its running in a server. Instead you need to use GetPlayers function to get the players or use a local script instead.
Report Abuse
PastDays is not online. PastDays
Joined: 09 Jan 2011
Total Posts: 732
07 Dec 2016 04:39 PM
I realised i had done that after i posted. Thanks for helping anyway.


|- PastDays -|
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