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 » Scripters
Home Search
 

Re: This script isn't working

Previous Thread :: Next Thread 
AaditSayam is not online. AaditSayam
Joined: 25 Apr 2016
Total Posts: 347
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 is not online. 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 is not online. 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
AaditSayam is not online. AaditSayam
Joined: 25 Apr 2016
Total Posts: 347
09 Jul 2017 07:55 AM
Oh, that was dumb of me. xD The script works now, Thanks for the help!
Report Abuse
Plutoeros is not online. Plutoeros
Joined: 13 Feb 2016
Total Posts: 214
09 Jul 2017 08:18 AM
No problem buddy :D


- VIShark15
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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