of     2   
chevron_rightchevron_rightchevron_right

EternalSouI
#162863404Sunday, May 24, 2015 10:41 PM GMT

local EternalSouI = Game.Players.LocalPlayer; --The player that can use the key down local Mouse = Player:GetMouse(); Mouse.KeyDown:connect(function(Key) if (Key:lower() == "x") then --The key to activate if (EternalSouI.Character ~= nil) then game.Workspace.EternalSouI.Humanoid.Speed = 25(); end end end) I'm trying to make it that one player can press a certain key and it changes their character's walkspeed. I'm just asking for some help I'm not asking someone to make it for me.
ByDefault
#162865536Sunday, May 24, 2015 11:02 PM GMT

if Key == "x" then
EternalSouI
#162866357Sunday, May 24, 2015 11:10 PM GMT

local EternalSouI = Game.Players.LocalPlayer; --The player that can use the keydown local Mouse = Player:GetMouse(); Mouse.KeyDown:connect(function(Key) if Key == "x") then --The key to activate if (EternalSouI.Character ~= nil) then game.Workspace.EternalSouI.Humanoid.Speed = 25();--Changes the player's speed end end end) Was it that? Because it didn't work.
Friedtjof
#162866670Sunday, May 24, 2015 11:13 PM GMT

local ply = game.Players.LocalPlayer; local Mouse = Player:GetMouse(); Mouse.KeyDown:connect(function(Key) if Key == "x") then if (ply.Character ~= nil) then ply.Character.Humanoid.Speed = 25() end end end) Lord of all things, breaded and unbreaded.
EternalSouI
#162867588Sunday, May 24, 2015 11:22 PM GMT

local EternalSouI = game.Players.LocalPlayer; local Mouse = Player:GetMouse(); Mouse.KeyDown:connect(function(Key) if Key == "x") then if (EternalSouI.Character ~= nil) then EternalSouI.Character.Humanoid.Speed = 25() end end end) It still didn't work. I first didn't changed the "ply" and it still did not work. I did press x.
Friedtjof
#162867815Sunday, May 24, 2015 11:24 PM GMT

Get rid of the stray parenthesis, sorry I missed that. Lord of all things, breaded and unbreaded.
EternalSouI
#162868652Sunday, May 24, 2015 11:32 PM GMT

local EternalSouI = game.Players.LocalPlayer; local Mouse = Player:GetMouse(); Mouse.KeyDown:connect(function(Key) if Key == "x" then if (EternalSouI.Character ~= nil) then EternalSouI.Character.Humanoid.Speed = 25 end end end) It didn't work. I put a "()" next to the 25 first then when it didn't work, I removed it. But it still didn't work.
Friedtjof
#162869317Sunday, May 24, 2015 11:39 PM GMT

local ply = game.Players.LocalPlayer local Mouse = ply:GetMouse() Mouse.KeyDown:connect(function(Key) if Key == "x" then if (ply.Character ~= nil) then ply.Character.Humanoid.Speed = 25 end end end) Lord of all things, breaded and unbreaded.
Friedtjof
#162869388Sunday, May 24, 2015 11:39 PM GMT

local ply = game.Players.LocalPlayer local Mouse = ply:GetMouse() Mouse.KeyDown:connect(function(Key) if Key == "x" then if (ply.Character ~= nil) then ply.Character.Humanoid.WalkSpeed = 25 end end end) Rather Lord of all things, breaded and unbreaded.
EternalSouI
#162870573Sunday, May 24, 2015 11:50 PM GMT

On the "ply" do I replace it the name of the player I only want to be able to change their speed when they press the key?
PraetorianTheGod
#162872133Monday, May 25, 2015 12:05 AM GMT

it's not speed it's walkspeed
EternalSouI
#162872886Monday, May 25, 2015 12:13 AM GMT

local EternalSouI = game.Players.LocalPlayer local Mouse = EternalSouI:GetMouse() Mouse.KeyDown:connect(function(Key) if Key == "x" then if (EternalSouI.Character ~= nil) then EternalSouI.Character.Humanoid.WalkSpeed = 25 end end end) It did work but, I tried it on my ALT and it also worked for my ALT..
flatline115
#162873475Monday, May 25, 2015 12:19 AM GMT

Remote Events and UserInputService.
EternalSouI
#162874130Monday, May 25, 2015 12:25 AM GMT

^ What?
pexf
#162875229Monday, May 25, 2015 12:35 AM GMT

It works for other people because EternalSoul is listed as an localplayer meaning the one pressing the key. =volty=
pexf
#162876113Monday, May 25, 2015 12:45 AM GMT

So this is what you'd do if you want it to work for you only. local EternalSouI = game.Workspace:WaitForChild("EternalSouI") local Mouse = EternalSouI:GetMouse() Mouse.KeyDown:connect(function(Key) if Key == "x" then if (EternalSouI.Character ~= nil) then EternalSouI.Character.Humanoid.WalkSpeed = 25 end end end) =volty=
EternalSouI
#162876840Monday, May 25, 2015 12:53 AM GMT

local EternalSouI = game.Workspace:WaitForChild("EternalSouI") local Mouse = EternalSouI:GetMouse() Mouse.KeyDown:connect(function(Key) if Key == "x" then if (EternalSouI.Character ~= nil) then EternalSouI.Character.Humanoid.WalkSpeed = 25 end end end) So I put it in and it didn't even change my walkspeed.
pexf
#162877387Monday, May 25, 2015 12:58 AM GMT

It probably only works in the server, not in studio ok =volty=
EternalSouI
#162878172Monday, May 25, 2015 1:06 AM GMT

I know I tried it in the game not test mode and it didn't change my walkspeed.
pexf
#162878495Monday, May 25, 2015 1:09 AM GMT

local player = game.Players.LocalPlayer local EternalSouI = game.Workspace:WaitForChild("EternalSouI") local Mouse = player:GetMouse() Mouse.KeyDown:connect(function(Key) if Key == "x" then if (EternalSouI.Character ~= nil) then EternalSouI.Character.Humanoid.WalkSpeed = 25 end end end) =volty=
EternalSouI
#162878957Monday, May 25, 2015 1:13 AM GMT

local player = game.Players.LocalPlayer local EternalSouI = game.Workspace:WaitForChild("EternalSouI") local Mouse = player:GetMouse() Mouse.KeyDown:connect(function(Key) if Key == "x" then if (EternalSouI.Character ~= nil) then EternalSouI.Character.Humanoid.WalkSpeed = 25 end end end) It still didn't change my walkspeed. I even changed it to 50 if the 25 speed didn't have a difference but it still did not change my walkspeed. I did not use F5 test mode either.
EternalSouI
#162886269Monday, May 25, 2015 2:25 AM GMT

bump
ByDefault
#162947204Monday, May 25, 2015 6:34 PM GMT

LocalScript in StarterPack local plr = game.Players.LocalPlayer local m = plr:GetMouse() m.KeyDown:connect(funciton(key) if key == "x" then workspace[plr.Name].Humanoid.WalkSpeed = 50 end end)
EternalSouI
#162956158Monday, May 25, 2015 7:37 PM GMT

local plr = game.Players.LocalPlayer local m = plr:GetMouse() m.KeyDown:connect(funciton(key) if key == "x" then workspace[EternalSouI].Humanoid.WalkSpeed = 50 end end) Is it like this? Because it did not change my speed when I press x. I typed the script inside a local script and put the local script into the starterpack.
flatline115
#162959507Monday, May 25, 2015 8:04 PM GMT

http://wiki.roblox.com/index.php?title=UserInputService http://wiki.roblox.com/index.php?title=RemoteEvent UserInputService is better than keydown and remoteevents for filtering.

    of     2   
chevron_rightchevron_rightchevron_right