Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I make a script when you press "F" the speed of the player increases to 100? [closed]

Asked by 4 years ago

local Input = game:GetService("UserInputService") UIS.InputBegan:Connect(function(input) if input.KeyCode == Enum.KeyCode.F then game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) character.Humanoid.WalkSpeed = 130

end)

0
use the characteradded as a variable VVoretex 146 — 4y
0
also capitalize the C in Character VVoretex 146 — 4y

Marked as Duplicate by PrismaticFruits, imKirda, JesseSong, and virushunter9

This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.

Why was this question closed?

1 answer

Log in to vote
0
Answered by
JoneXI 51
4 years ago

You need to put the PlayerAdded and CharacterAdded functions before

local Input = game:GetService("UserInputService")

game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character)     
Input.InputBegan:Connect(function(input) 
    if input.KeyCode == Enum.KeyCode.F then
                character.Humanoid.WalkSpeed = 130  
            end
        end)
    end)
end)

Tell me if that works. Also If it helped don't forget to mark as answered :)

Ad