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

Previous Thread :: Next Thread 
JoeDev is not online. JoeDev
Joined: 04 Oct 2011
Total Posts: 6475
08 Aug 2017 09:34 AM

script.Parent.Touched:connect(function()
game.Players.LocalPlayer.PlayerGui.ScreenGui.Enabled = true
wait(3)
game.Players.LocalPlayer.PlayerGui.ScreenGui.Enabled = false
end)

--This is a regular script that only works in studio. The dev console says it cannot locate LocalPlayer, so I ask you, what is the correct child name of Players in RobloxPlayer in this case?
Report Abuse
Vezious is not online. Vezious
Joined: 09 Nov 2013
Total Posts: 606
08 Aug 2017 09:40 AM
Are you using a local script?
Report Abuse
JoeDev is not online. JoeDev
Joined: 04 Oct 2011
Total Posts: 6475
08 Aug 2017 09:45 AM
No, but its not supposed to be.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
08 Aug 2017 09:47 AM
How do you expect LocalPlayer to work when the Server doesn't have a player?


Report Abuse
Vezious is not online. Vezious
Joined: 09 Nov 2013
Total Posts: 606
08 Aug 2017 09:48 AM
Then LocalPlayer won't work.

Use Part and find the Character, then the Player.


script.Parent.Touched:connect(function(Part)
local Character = Part.Parent
local Player = game.Players:GetPlayerFromCharacter(Character)
if Player then
-- fill in the rest boi
end
end)
Report Abuse
JoeDev is not online. JoeDev
Joined: 04 Oct 2011
Total Posts: 6475
08 Aug 2017 10:00 AM
It works, despite the fact that it says "Workspace.Part.Script:6: attempt to index local 'Player' (a nil value)"
Report Abuse
JoeDev is not online. JoeDev
Joined: 04 Oct 2011
Total Posts: 6475
08 Aug 2017 10:07 AM
If I change the variable name, then the script doesn't work, why?
Report Abuse
Vezious is not online. Vezious
Joined: 09 Nov 2013
Total Posts: 606
08 Aug 2017 10:11 AM
Well that's why I put the 'if player'. That error shouldn't be happening. What variable?
Report Abuse
JoeDev is not online. JoeDev
Joined: 04 Oct 2011
Total Posts: 6475
08 Aug 2017 10:12 AM
local Player
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