|
| 24 May 2015 05:41 PM |
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.
|
|
|
| Report Abuse |
|
|
ByDefault
|
  |
| Joined: 25 Jul 2014 |
| Total Posts: 3197 |
|
| |
|
|
| 24 May 2015 06:10 PM |
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. |
|
|
| Report Abuse |
|
|
|
| 24 May 2015 06:13 PM |
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. |
|
|
| Report Abuse |
|
|
|
| 24 May 2015 06:22 PM |
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. |
|
|
| Report Abuse |
|
|
|
| 24 May 2015 06:24 PM |
Get rid of the stray parenthesis, sorry I missed that.
Lord of all things, breaded and unbreaded. |
|
|
| Report Abuse |
|
|
|
| 24 May 2015 06:32 PM |
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. |
|
|
| Report Abuse |
|
|
|
| 24 May 2015 06:39 PM |
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. |
|
|
| Report Abuse |
|
|
|
| 24 May 2015 06:39 PM |
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. |
|
|
| Report Abuse |
|
|
|
| 24 May 2015 06:50 PM |
| 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? |
|
|
| Report Abuse |
|
|
|
| 24 May 2015 07:05 PM |
| it's not speed it's walkspeed |
|
|
| Report Abuse |
|
|
|
| 24 May 2015 07:13 PM |
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.. |
|
|
| Report Abuse |
|
|
|
| 24 May 2015 07:19 PM |
| Remote Events and UserInputService. |
|
|
| Report Abuse |
|
|
| |
|
voItages
|
  |
| Joined: 02 Nov 2013 |
| Total Posts: 677 |
|
|
| 24 May 2015 07:35 PM |
It works for other people because EternalSoul is listed as an localplayer meaning the one pressing the key.
=volty= |
|
|
| Report Abuse |
|
|
voItages
|
  |
| Joined: 02 Nov 2013 |
| Total Posts: 677 |
|
|
| 24 May 2015 07:45 PM |
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= |
|
|
| Report Abuse |
|
|
|
| 24 May 2015 07:53 PM |
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. |
|
|
| Report Abuse |
|
|
voItages
|
  |
| Joined: 02 Nov 2013 |
| Total Posts: 677 |
|
|
| 24 May 2015 07:58 PM |
It probably only works in the server, not in studio ok
=volty= |
|
|
| Report Abuse |
|
|
|
| 24 May 2015 08:06 PM |
| I know I tried it in the game not test mode and it didn't change my walkspeed. |
|
|
| Report Abuse |
|
|
voItages
|
  |
| Joined: 02 Nov 2013 |
| Total Posts: 677 |
|
|
| 24 May 2015 08:09 PM |
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= |
|
|
| Report Abuse |
|
|
|
| 24 May 2015 08:13 PM |
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. |
|
|
| Report Abuse |
|
|
| |
|
ByDefault
|
  |
| Joined: 25 Jul 2014 |
| Total Posts: 3197 |
|
|
| 25 May 2015 01:34 PM |
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) |
|
|
| Report Abuse |
|
|
|
| 25 May 2015 02:37 PM |
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. |
|
|
| Report Abuse |
|
|
|
| 25 May 2015 03:04 PM |
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. |
|
|
| Report Abuse |
|
|