|
| 09 Jul 2017 07:26 AM |
I made a script which is supposed to change the speed of the player, But when I test the game, It doesn't do anything. Here's my script:
local speedBoost = script.Parent
local function steppedOn(SpeedGiver) local parent = SpeedGiver.Parent if game.Players:GetPlayerFromCharacter(parent) then parent.Humanoid.WalkSpeed = 57 end end |
|
|
| Report Abuse |
|
|
Plutoeros
|
  |
| Joined: 13 Feb 2016 |
| Total Posts: 214 |
|
|
| 09 Jul 2017 07:39 AM |
You forgot to place the handler at the bottom which runs the function defined when the player steps on the block, I have provided the fixed script, let me know if there's anymore problems.
local speedBoost = script.Parent
local function steppedOn(SpeedGiver) local parent = SpeedGiver.Parent if game.Players:GetPlayerFromCharacter(parent) then parent.Humanoid.WalkSpeed = 57 end end
script.Parent.Touched:connect(steppedOn)
- VIShark15 |
|
|
| Report Abuse |
|
|
Plutoeros
|
  |
| Joined: 13 Feb 2016 |
| Total Posts: 214 |
|
|
| 09 Jul 2017 07:46 AM |
Or if you wanted to give a player speed without having to touch a block, put this within a normal script that's located in the ServerScriptService:
function characterSpeed(plr) if plr ~= nil then plr.WalkSpeed = 57 end end
while true do findChild = game.Players:GetChildren() for i = 1, #findChild do characterSpeed(findChild[i].Character.Humanoid) wait(0.1) end wait(4) end
- VIShark15 |
|
|
| Report Abuse |
|
|
|
| 09 Jul 2017 07:55 AM |
| Oh, that was dumb of me. xD The script works now, Thanks for the help! |
|
|
| Report Abuse |
|
|
Plutoeros
|
  |
| Joined: 13 Feb 2016 |
| Total Posts: 214 |
|
|
| 09 Jul 2017 08:18 AM |
No problem buddy :D
- VIShark15 |
|
|
| Report Abuse |
|
|