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

How can I make the player faster if they have a gamepass?

Asked by
iHavoc101 127
5 years ago

The parent is a script called"SprintScript Importer":

01function onPlayerEntered(player)
02    repeat wait () until player.Character ~= nil
03    local s = script.SprintScript:clone()
04    s.Parent = player.Character
05    s.Disabled = false
06    player.CharacterAdded:connect(function (char)
07        local s = script.SprintScript:clone()
08        s.Parent = char
09        s.Disabled = false     
10    end)
11end
12 
13game.Players.PlayerAdded:connect(onPlayerEntered)

The child is a local script call "SprintScript":

01local mouse = game.Players.LocalPlayer:GetMouse()
02local running = false
03 
04function getTool() 
05    for _, kid in ipairs(script.Parent:GetChildren()) do
06        if kid.className == "Tool" then return kid end
07    end
08    return nil
09end
10 
11 
12mouse.KeyDown:connect(function (key) -- Run function
13    key = string.lower(key)
14    if string.byte(key) == 48 then
15        running = true
View all 34 lines...

1 answer

Log in to vote
0
Answered by
starmaq 1290 Moderation Voter
5 years ago

.KeyDown is deprecated, outdated, it no longer works, so you need something newer, the UserInputService which is cooler. good tutorial on it

Ad

Answer this question