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: LOCAL PLAYER HELP!

Previous Thread :: Next Thread 
mrmcmuffinz123 is online. mrmcmuffinz123
Joined: 04 Aug 2014
Total Posts: 810
09 Jul 2017 10:34 PM
Recently local player hasn't been working for me my script: game.Players.LocalPlayer and it says that's a nil value


Report Abuse
King_Pith is not online. King_Pith
Joined: 12 Feb 2017
Total Posts: 8
09 Jul 2017 10:42 PM
local player = game.Players.LocalPlayer
Report Abuse
edenDeden is not online. edenDeden
Joined: 29 Jul 2016
Total Posts: 370
09 Jul 2017 10:57 PM
make sure u using a LOCAL script for a LOCAL player


Report Abuse
mrmcmuffinz123 is online. mrmcmuffinz123
Joined: 04 Aug 2014
Total Posts: 810
10 Jul 2017 10:28 AM
Well my script clones a UI when somebody sits in a vehicle seat then when you jump out of the seat it removes the UI and to remove that ui I need to use local player in a normal script


Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
10 Jul 2017 11:00 AM
LocalPlayer isn't a magical force that can find exactly who you need. Each player has their own LocalScripts, and so the LocalScripts specific to them can access LocalPlayer because it knows who it is. In a Script, it runs on the server rather than a player's computer. There is know way for it to know what you mean, because there is no associated player.

You need to find another way. Maybe use game.Players:GetPlayerFromCharacter(Theircharacter)?


Report Abuse
mrmcmuffinz123 is online. mrmcmuffinz123
Joined: 04 Aug 2014
Total Posts: 810
10 Jul 2017 02:06 PM
I found a way to sorta fix it but what i was doing was if you sit in a vehicle seat you will get a gui but to make it work I had to make it check if I was in the game if i am it will make the gui pop up on my screen ONLY which isn't what I want


Report Abuse
spacesplitter is not online. spacesplitter
Joined: 10 Jul 2015
Total Posts: 44
10 Jul 2017 04:04 PM
LocalPlayer should be used in a LocalScript, the reason why: Because it is running on a client it knows what Local player you mean, in a script, you may be doing like this

Example when touching a brick then the leaderstats will change by +1 on bricks
--Inside a script inside the brick
script.Parent.Touched:connect(function(hit)
h = hit.Parent:FindFirstChild("Humanoid")
if h then --hit.Parent.Name is a string and can be used in WaitForChild
game.Players:WaitForChild(hit.Parent.Name).leaderstats.Bricks.Value = game.Players:WaitForChild(hit.Parent.Name).leaderstats.Bricks.Value+1
end

These can be used to redirect a string to a pattern:
example finding me
game.Players:WaitForChild("spacesplitter")
game.players:FindFirstChild("spacesplitter")
game.Players["spacesplitter"]
Note: the pattern '[""]' should be used if you have spaces in name or characters that is not compatible such as game.Players.space splitter--Would not work this would work
game.Players["space splitter"]--this is the right code


Report Abuse
mrmcmuffinz123 is online. mrmcmuffinz123
Joined: 04 Aug 2014
Total Posts: 810
10 Jul 2017 04:23 PM
Yeah I know... I'm saying i have no choice but to use a script


Report Abuse
spacesplitter is not online. spacesplitter
Joined: 10 Jul 2015
Total Posts: 44
10 Jul 2017 04:24 PM
I tried to help you but, you didn't say if i helped you or not

ÄÄÄÄÄHHHHHHH


Report Abuse
mrmcmuffinz123 is online. mrmcmuffinz123
Joined: 04 Aug 2014
Total Posts: 810
10 Jul 2017 07:02 PM
You helped for a tool i'm making which didn't work if you input a player name because nobody has a "working" name


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