|
| 25 Sep 2016 04:25 PM |
I want to be able to change a player's WalkSpeed when they walk on a brick and change it back to normal when they walk off.
I've tried Touched and TouchEnded, however, walking is wonky with both and WalkSpeed constatly fluctuates between 16 and 32 (new walkspeed) since each leg leaves the ground for a bit.
Is magnitude a viable option? I'm reluctant to use magnitude since if I put two bricks with different effects by each other they will conflict.
I might just be looking at it the wrong way and being stupid though. :P |
|
|
| Report Abuse |
|
|
| |
|
|
| 25 Sep 2016 04:35 PM |
part.Touched
part.TouchEnded http://wiki.roblox.com/index.php?title=API:Class/BasePart#EventsmemberhiddenEvents_.5Btoggle.5D |
|
|
| Report Abuse |
|
|
kayak503
|
  |
| Joined: 09 Dec 2013 |
| Total Posts: 11 |
|
|
| 25 Sep 2016 04:58 PM |
Wunder_Wulfe has the idea but i will right a script for you
script.Parent.Touched:connect(function(hit) local human = hit.Parent:findFirstChild("Humanoid") if (human ~= nil) then human.WalkSpeed = human.WalkSpeed+5 wait(5) end end)
script.Parent.TouchEnded:connect(function(hit) local human = hit.Parent:findFirstChild("Humanoid") if (human ~= nil) then human.WalkSpeed = human.WalkSpeed-5 end end)
|
|
|
| Report Abuse |
|
|
kayak503
|
  |
| Joined: 09 Dec 2013 |
| Total Posts: 11 |
|
|
| 25 Sep 2016 05:00 PM |
| and make to block uncollidable and in air |
|
|
| Report Abuse |
|
|
| |
|
|
| 25 Sep 2016 05:45 PM |
why do people assume that the humanoid is in the player
In Normal Script: local player = game.Players.PlayerName
function Touched() player.Character.Humanoid.Walkspeed = 30 end
function TouchedEnded() player.Character.Humanoid.Walkspeed = 16 end
Part.TouchEnded:connect(TouchedEnded) Part.Touched:connect(Touched)
----------------------------------------------
In Local script: local player = game.Players.PlayerName
function Touched() player.Character.Humanoid.Walkspeed = 30 end
function TouchedEnded() player.Character.Humanoid.Walkspeed = 16 end
Part.TouchEnded:connect(TouchedEnded) Part.Touched:connect(Touched)
|
|
|
| Report Abuse |
|
|
|
| 25 Sep 2016 05:47 PM |
in local script: local player = game.Players.LocalPlayer
function Touched() player.Character.Humanoid.Walkspeed = 30 end
function TouchedEnded() player.Character.Humanoid.Walkspeed = 16 end
Part.TouchEnded:connect(TouchedEnded) Part.Touched:connect(Touched) |
|
|
| Report Abuse |
|
|