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: Why does this script only work in test mode?

Previous Thread :: Next Thread 
thetacah is not online. thetacah
Joined: 18 Jan 2013
Total Posts: 16026
14 Aug 2013 05:54 PM
function changewalkspeed()
local Player = game.Players.LocalPlayer
Player.Character.Humanoid.WalkSpeed = game.Workspace.walkspeed.Value--walkspeed is a intvalue
end
script.Parent.MouseButton1Click:connect(changewalkspeed)
Report Abuse
expressmyself is not online. expressmyself
Joined: 19 Apr 2011
Total Posts: 1768
14 Aug 2013 05:57 PM
is this in a LocalScript>
Report Abuse
thetacah is not online. thetacah
Joined: 18 Jan 2013
Total Posts: 16026
14 Aug 2013 05:57 PM
expressmyself, no
Report Abuse
expressmyself is not online. expressmyself
Joined: 19 Apr 2011
Total Posts: 1768
14 Aug 2013 05:59 PM
If not make it a Local Script or put this in normal script

game.Players.PlayerAdded:connect(function(player)
wait()
player.Character.Humanoid.WalkSpeed = game.Workspace.walkspeed.Value
end)
this on't work in a server

The reason it only works in play solo because everything is client side
Report Abuse
expressmyself is not online. expressmyself
Joined: 19 Apr 2011
Total Posts: 1768
14 Aug 2013 06:00 PM
The one I gave you doesn't work in solo. unless you want one that works in both.
Report Abuse
Clayguy247 is not online. Clayguy247
Joined: 03 Sep 2008
Total Posts: 3394
14 Aug 2013 06:06 PM
You can't use "game.Players.LocalPlayer" in a normal script.

Normal scripts run on the server, thus attempting to do such would not work because your player is client based.

Local scripts are client side, so you'd have to do that but with a localscript.

Or you can just try to define the player a different way. Like, getPlayerFromCharacter(character)
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