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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 25 Jun 2014 02:35 PM |
a.Parent.WalkSpeed
Did you mean:
a.Parent.Humanoid.WalkSpeed |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|