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 » Game Design
Home Search
 

Re: Default Roblox Sprint Script Help

Previous Thread :: Next Thread 
bak44 is not online. bak44
Joined: 23 Oct 2010
Total Posts: 9
15 Jun 2017 11:53 AM
Im making a game right now and there is a default sprint script from roblox that makes my speed 85 when i press left shift and if i change it it doesnt matter because when i die it will go back to 85 since the sprintscript is automatically put into every player. i need to find the source or something to disable the script. Also if i just add another sprint script at the speed i want then it works until i respawn and then the other sprintscript takes over. The script spawns in the model player 1.
Report Abuse
Horrible_Pun is not online. Horrible_Pun
Joined: 13 May 2017
Total Posts: 5102
15 Jun 2017 11:58 AM
Change the part of the script that triggers the death-speed regen.
Report Abuse
bak44 is not online. bak44
Joined: 23 Oct 2010
Total Posts: 9
15 Jun 2017 02:41 PM
local mouse = game.Players.LocalPlayer:GetMouse()
local running = false

function getTool()
for _, kid in ipairs(script.Parent:GetChildren()) do
if kid.className == "Tool" then return kid end
end
return nil
end


mouse.KeyDown:connect(function (key) -- Run function
key = string.lower(key)
if string.byte(key) == 48 then
running = true
local keyConnection = mouse.KeyUp:connect(function (key)
if string.byte(key) == 48 then
running = false
end
end)
for i = 1,5 do
game.Workspace.CurrentCamera.FieldOfView = (70+(i*2))
wait()
end
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 85
repeat wait () until running == false
keyConnection:disconnect()
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 16
for i = 1,5 do
game.Workspace.CurrentCamera.FieldOfView = (80-(i*2))
wait()
end
end
end)

thi is the script it shows up in game.Workspace.Player1 i want people to be able to run but i want to change the speed from like 85 to 30. i can only view this script when i am playing as a character
Report Abuse
Horrible_Pun is not online. Horrible_Pun
Joined: 13 May 2017
Total Posts: 5102
15 Jun 2017 05:16 PM
local mouse = game.Players.LocalPlayer:GetMouse()
local running = false

function getTool()
for _, kid in ipairs(script.Parent:GetChildren()) do
if kid.className == "Tool" then return kid end
end
return nil
end


mouse.KeyDown:connect(function (key) -- Run function
key = string.lower(key)
if string.byte(key) == 48 then
running = true
local keyConnection = mouse.KeyUp:connect(function (key)
if string.byte(key) == 48 then
running = false
end
end)
for i = 1,5 do
game.Workspace.CurrentCamera.FieldOfView = (70+(i*2))
wait()
end
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 30
repeat wait () until running == false
keyConnection:disconnect()
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 30
for i = 1,5 do
game.Workspace.CurrentCamera.FieldOfView = (80-(i*2))
wait()
end
end
end)
Report Abuse
bak44 is not online. bak44
Joined: 23 Oct 2010
Total Posts: 9
15 Jun 2017 07:06 PM
Yeah i put that script so it spawns in my character already but the problem is that it works to keep my speed the way i want it one time but when i die and respawn the old script that sets my speed at 85 takes priority. I want to figure out how the script that sets my speed at 85 is even getting in my character becuase otherwise it wont matter if i change it.
Report Abuse
WXBZ is not online. WXBZ
Joined: 10 Oct 2012
Total Posts: 850
15 Jun 2017 07:23 PM
local mouse = game.Players.LocalPlayer:GetMouse()
local running = false

function getTool()
for _, kid in ipairs(script.Parent:GetChildren()) do
if kid.className == "Tool" then return kid end
end
return nil
end


mouse.KeyDown:connect(function (key) -- Run function
key = string.lower(key)
if string.byte(key) == 48 then
running = true
local keyConnection = mouse.KeyUp:connect(function (key)
if string.byte(key) == 48 then
running = false
end
end)
for i = 1,5 do
game.Workspace.CurrentCamera.FieldOfView = (40+(i*2))
wait()
end
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 30
repeat wait () until running == false
keyConnection:disconnect()
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 30
for i = 1,5 do
game.Workspace.CurrentCamera.FieldOfView = (80-(i*2))
wait()
end
end

That will put it to 55 ^

The thing that is setting the speed is
game.Workspace.CurrentCamera.FieldOfView = (40+(i*2))


Report Abuse
WXBZ is not online. WXBZ
Joined: 10 Oct 2012
Total Posts: 850
15 Jun 2017 07:24 PM
Whoops messed it up, redoing it.


Report Abuse
bak44 is not online. bak44
Joined: 23 Oct 2010
Total Posts: 9
15 Jun 2017 09:09 PM
okay i want the walkspeed to be 16 and then the run speed 30. Remember that this script is automatically added to each player (i dont know why or how it just happens) so i need to find a way to make this script either go away, find where it is coming from, or another run script that overrides this one, because lets say you make a run script that makes my run speed 30 when i press shift and when i die it still works, there would still be the run script that makes my speed 85 and those scripts are both trying to give me a differen run speed. so just adding a different run script doesnt work i tried that i need to find a way to stop the other script from going in each player. is there possibly a script i could make that deletes the run script in each player as they spawn each time and then make my own run script that roblox didnt put in each player?
Report Abuse
bak44 is not online. bak44
Joined: 23 Oct 2010
Total Posts: 9
15 Jun 2017 09:10 PM
woops i didnt read the end of your post about where the script is coming from lol
Report Abuse
bak44 is not online. bak44
Joined: 23 Oct 2010
Total Posts: 9
15 Jun 2017 09:35 PM
local Players = game:GetService("Players")

function onPlayerAdded(player)
print(player.Name .. " has entered the game")
local Part = game.Players.LocalPlayer.SprintScript
Part:Destroy()
Part.Parent = game.Players.LocalPlayer
end

--When a player joins, call the onPlayerAdded function
Players.PlayerAdded:connect(onPlayerAdded)

--Call onPlayerAdded for each player already in the game
for _,player in pairs(Players:GetPlayers()) do
onPlayerAdded(player)
end

what if i did something along the lines of this to delete the roblox (SprintScript) script and then just add my own script with the speed i want to every player
Report Abuse
bak44 is not online. bak44
Joined: 23 Oct 2010
Total Posts: 9
15 Jun 2017 11:18 PM
local Players = game:GetService("Players") function onPlayerAdded(player) print(player.Name .. " has entered the game") end game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(character) wait(2) local script = character.SprintScript script.Disabled = true end) end) --When a player joins, call the onPlayerAdded function Players.PlayerAdded:connect(onPlayerAdded) --Call onPlayerAdded for each player already in the game for _,player in pairs(Players:GetPlayers()) do onPlayerAdded(player) end this script works to disable the sprintscript so then i can just make my own sprint script. however how can i make it so the function keeps repeating until ### ############### = true just in case the script isnt loaded in the first time the function runs
Report Abuse
bak44 is not online. bak44
Joined: 23 Oct 2010
Total Posts: 9
15 Jun 2017 11:19 PM
local Players = game:GetService("Players")

function onPlayerAdded(player)
print(player.Name .. " has entered the game")
end

game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
wait(2)
local script = character.SprintScript
script.Disabled = true
end)
end)


--When a player joins, call the onPlayerAdded function
Players.PlayerAdded:connect(onPlayerAdded)

--Call onPlayerAdded for each player already in the game
for _,player in pairs(Players:GetPlayers()) do
onPlayerAdded(player)
end

sorry about the script being messed up
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Game Design
   
 
   
  • 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