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: Changing a players walkspeed

Previous Thread :: Next Thread 
DaDesign is not online. DaDesign
Joined: 27 Apr 2014
Total Posts: 53
25 Jun 2014 02:05 PM
I'm trying to set a players walk-speed but I only know how to define a certain player in a script. I want this to work so that if any player joins the game and touches the brick, their walkspeed will be set to 0. I came up with this but it didn't work inside a localscript...

function onTouched(hit)
pl = game.Players.LocalPlayer
ch = pl.Character
ch.Humanoid.WalkSpeed = 0
end
script.Parent.Touched:connect(onTouched)
Report Abuse
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
25 Jun 2014 02:07 PM
--regular script

script.Parent.Touched:connect(function(hit)
if game.Players:FindFirstChild(hit.Parent.Name) then
hit.Parent:WaitForChild("Humanoid").WalkSpeed = 0
end
end)
Report Abuse
wubbzy301 is not online. wubbzy301
Joined: 15 May 2010
Total Posts: 1188
25 Jun 2014 02:10 PM
Try this


function onTouched(hit)
pl = game.Players.LocalPlayer
ch = pl.Character
ch.Humanoid.WalkSpeed = 0
end
Workspace.PartNameHere.Touched:connect(onTouched)


Put the localscript into the player.


- dun dun dun a ghost is coming for you
Report Abuse
wubbzy301 is not online. wubbzy301
Joined: 15 May 2010
Total Posts: 1188
25 Jun 2014 02:12 PM
If you want to make a player that touches stop walking, use only a script

function onTouched(hit)
human = hit.Parent:FindFirstChild("Humanoid")
if human then
human.WalkSpeed = 0
human.WalkSpeed = 0
end
end
script.Parent.Touched:connect(onTouched)

- dun dun dun a ghost is coming for you
Report Abuse
Goodis is not online. Goodis
Joined: 14 Jan 2010
Total Posts: 253
25 Jun 2014 02:35 PM
script.Parent.Touched:connect(function(a)if(a.Parent:findFirstChild'Humanoid')then a.Parent.WalkSpeed=100;end;end);

idiots
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
25 Jun 2014 02:35 PM
a.Parent.WalkSpeed

Did you mean:

a.Parent.Humanoid.WalkSpeed
Report Abuse
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
25 Jun 2014 02:40 PM
Goodis; just because you fit everything into 2 lines using a very similar script to mine, doesnt make us idiots.
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