Hello Ben. I think I found the solution to your problem.
What we need to do is create a LocalScript(so we can access the LocalPlayer) and place it into our StarterPack, as it's the pack we start off with when we join.
Now you need to put some variables into that script.
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local uis = game:GetService("UserInputService")
local walk = 16
local sprint = 32
Now that we have sorted all of that out, it's time to begin functioning.
We're going to firstly call some functions(InputBegan and InputEnded)
uis.InputBegan:Connect(function(key)
end)
uis.InputEnded:Connect(function(key)
end)
Then we're going to check if whoever is clicking the button is clicking LShift(Left Shift)
uis.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.LeftShift then
end
end)
uis.InputEnded:Connect(function(key)
if key.KeyCode == Enum.KeyCode.LeftShift then
end
end)
Now that we now know what button they are pressing, we're going to run some code if they are pressing that button.
In this case we'll be using our 'walk' and 'sprint' value.
uis.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.LeftShift then
char.Humanoid.WalkSpeed = sprint
end
end)
uis.InputEnded:Connect(function(key)
if key.KeyCode == Enum.KeyCode.LeftShift then
char.Humanoid.WalkSpeed = walk
end
end)
Tadahh!!! All you have to do is now put the variables we've listed from above into the script and then you're officially done! You can insert Aura's if you wish through the Server to the Client, or the Server in general. If you do not know how to do that, check out videos specialising in the topic, 'RemoteEvents'.
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local uis = game:GetService("UserInputService")
local walk = 16
local sprint = 32
uis.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.LeftShift then
char.Humanoid.WalkSpeed = sprint
end
end)
uis.InputEnded:Connect(function(key)
if key.KeyCode == Enum.KeyCode.LeftShift then
char.Humanoid.WalkSpeed = walk
end
end)
I hope I helped, if I did please click 'Accept' to show me support!
2 comments
Well it worked, sort of. The aura DOES appear when I press left shift, but I only want it to appear when the character is running. That is an issue I have been actually been having with a few other things. Do you know how to do that?
Well in the InputBegan function - make it so the Particles/Aura appears using Enabled or Visible. Then in InputEnded - make it so the Particles/Aura disappears.