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 » Scripting Helpers
Home Search
 

Re: Error with script

Previous Thread :: Next Thread 
PurelyRandom is not online. PurelyRandom
Joined: 05 Mar 2011
Total Posts: 36763
17 Jun 2014 11:28 AM
Getting this error:

09:25:59.129 - function onTouched(hit)
local player = game.Players:Get:8: attempt to index global 'script' (a nil value)



With this script:

function onTouched(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
game:GetService("TeleportService"):Teleport(game.Workspace.TeleportDisplay.PlaceIdValue.Value, player)
end
end

script.Parent.Touched:connect(onTouched)



And I'm not sure what it means.
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
17 Jun 2014 11:30 AM
are you using a normal script under the brick?
Report Abuse
PurelyRandom is not online. PurelyRandom
Joined: 05 Mar 2011
Total Posts: 36763
17 Jun 2014 11:30 AM
Yes
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
17 Jun 2014 11:32 AM
function onTouched(hit)
local player = hit.Parent and game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
game:GetService("TeleportService"):Teleport(game.Workspace.TeleportDisplay.PlaceIdValue.Value, player)
end
end

script.Parent.Touched:connect(onTouched)
Report Abuse
PurelyRandom is not online. PurelyRandom
Joined: 05 Mar 2011
Total Posts: 36763
17 Jun 2014 11:34 AM
Alright, going to test the script now.

Already ran it in Command Bar and no error.

But can you explain what fixed it? All I see is that you changed what the player variable is
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
17 Jun 2014 11:46 AM
I checked to see if there was a parent of hit since without it, it would error.
If it still does not work then I am stumped.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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