|
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.
|
|
ByDefaultJoin Date: 2014-07-25 Post Count: 4022 |
if Key == "x" then |
|
|
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. |
|
FriedtjofJoin Date: 2010-07-02 Post Count: 1932 |
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. |
|
|
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. |
|
FriedtjofJoin Date: 2010-07-02 Post Count: 1932 |
Get rid of the stray parenthesis, sorry I missed that.
Lord of all things, breaded and unbreaded. |
|
|
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. |
|
FriedtjofJoin Date: 2010-07-02 Post Count: 1932 |
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. |
|
FriedtjofJoin Date: 2010-07-02 Post Count: 1932 |
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. |
|
|
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? |
|
|
it's not speed it's walkspeed |
|
|
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.. |
|
|
Remote Events and UserInputService. |
|
|
pexfJoin Date: 2013-11-02 Post Count: 1195 |
It works for other people because EternalSoul is listed as an localplayer meaning the one pressing the key.
=volty= |
|
pexfJoin Date: 2013-11-02 Post Count: 1195 |
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= |
|
|
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. |
|
pexfJoin Date: 2013-11-02 Post Count: 1195 |
It probably only works in the server, not in studio ok
=volty= |
|
|
I know I tried it in the game not test mode and it didn't change my walkspeed. |
|
pexfJoin Date: 2013-11-02 Post Count: 1195 |
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= |
|
|
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. |
|
|
ByDefaultJoin Date: 2014-07-25 Post Count: 4022 |
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) |
|
|
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. |
|
|