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 Issue! []

Previous Thread :: Next Thread 
Spec_Light is not online. Spec_Light
Joined: 08 Apr 2016
Total Posts: 22
16 Oct 2016 01:42 PM
I need help!
[CODE]
local player = game.Players.LocalPlayer.Character
player:MoveTo(game.Workspace.Spawn.Position)
player:MoveTo(game.Workspace.Spawn.Position)
function hover()
print("um>")
for i= 1, 10 do
script.Parent.BorderSizePixel = script.Parent.BorderSizePixel +1
wait(0.1)
end
end
function nothover()
for i= 1,10 do
script.Parent.BorderSizePixel = script.Parent.BorderSizePixel -1
wait(0.1)
end
end
function click()
script.Parent.Visible = false
game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
player:MoveTo(game.Workspace.SpawnG.Position)


end
script.Parent.MouseButton1Click:connect(click)
script.Parent.MouseLeave:connect(nothover)
script.Parent.MouseEnter:connect(hover)
[Error]
Players.Player2.PlayerGui.ScreenGui.TextButton.LocalScript:2: attempt to index local 'player' (a nil value)
Also this is a local script i dont understand why its not working
Report Abuse
Spec_Light is not online. Spec_Light
Joined: 08 Apr 2016
Total Posts: 22
30 Dec 2016 02:29 PM
For anyone stuck with is
Its just because player was just too quickly defined so what i would do i
local player = game.Players:WaitForChild("LocalPlayer").Character

or just add a simple wait such as wait(0.1)
Report Abuse
Askadaf is not online. Askadaf
Joined: 14 Oct 2016
Total Posts: 39
30 Dec 2016 02:32 PM
local player = game.Players.LocalPlayer
repeat wait() until player.Character
local char = player.Character
Report Abuse
SirTipsAlot is not online. SirTipsAlot
Joined: 08 Feb 2012
Total Posts: 2431
30 Dec 2016 02:35 PM
i'll do you one better

local player=game.Players.LocalPlayer.CharacterAdded:Wait()


Report Abuse
KillerKyle is not online. KillerKyle
Joined: 29 Jul 2007
Total Posts: 6371
30 Dec 2016 02:35 PM
^ correct

The reasoning behind this is because your script is loading faster then the Character is loading. So when the script looks for the Character, the script crashes.

Then the Character loads.

His line will tell the script to loop itself until the Character is loaded.
Report Abuse
Spec_Light is not online. Spec_Light
Joined: 08 Apr 2016
Total Posts: 22
30 Dec 2016 02:36 PM
Gud you saved me
Report Abuse
whiplordXD is not online. whiplordXD
Joined: 08 Aug 2016
Total Posts: 4
30 Dec 2016 02:59 PM
I realy need help with scripting my game please help
Report Abuse
whiplordXD is not online. whiplordXD
Joined: 08 Aug 2016
Total Posts: 4
30 Dec 2016 03:04 PM
I need help with making level's and a timer
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