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: Localscript in local space not running

Previous Thread :: Next Thread 
Greendolph is not online. Greendolph
Joined: 07 May 2008
Total Posts: 2543
06 Dec 2013 05:22 PM
I have a local script in a model in the players camera, but the script does not run. It has print statements but none of them print. There is no output from this script whatsoever.

local unit = script.Parent
local destcon
print("Unit Script Loaded")

destcon = unit.ListReferance.Value.Path.Destination.Changed:connect(function(v)
status, error = pcall(move_to(v))
if not status then print(error) end
end);

function move_to(destination)
print(destination)
pos = unit.Parent.Parent.World[destination].Position + Vector3.new(0, 3, 0)
cs = CFrame.new(unit.Center.Position, pos)
for i = 0, -(unit.Center.Position - pos).magnitude, -unit.ListReferance.Speed.Value/100 do
unit.Center.CFrame = cs * CFrame.new(0, 0, -i)
wait()
end
end

Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
06 Dec 2013 05:41 PM
Will the Changed event of a Vector3Value trigger if the Value is changed?
Also, pcall will ALWAYS fail because you have wait() in the moveto function. Change pcall to ypcall.
Report Abuse
wazap is not online. wazap
Joined: 29 Jun 2007
Total Posts: 23234
06 Dec 2013 06:21 PM
How did you test these? Sometimes LocalScript errors dont show up Play Solo mode, nor does it show up in the RemoteMoniteringScript. Use Start Server -> Start Player, and then look in the Player's output box.
Report Abuse
Jetta765214 is not online. Jetta765214
Joined: 22 Oct 2008
Total Posts: 1855
06 Dec 2013 07:14 PM
solo mode is only local scripts(Normal scripts are considered local i don't know if the _G is the same though, but localplayer and camera manipulation all work from a normal script). Any error from local script does show up in output in solo mode.
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
06 Dec 2013 10:47 PM
"solo mode is only local scripts(Normal scripts are considered local i don't know if the _G is the same though, but localplayer and camera manipulation all work from a normal script). Any error from local script does show up in output in solo mode."

It would make sense that the _G would be the same between LocalScripts and Scripts in Solo mode. The game is run on the local machine itself, so both the player and the server are running on the local machine (not just the player), meaning all scripts will run locally, regardless of class.
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