#My shift to sprint gamepass is notworking
13 messages · Page 1 of 1 (latest)
repeat wait() until game.Players.LocalPlayer.Character
local Player = game.Players.LocalPlayer
local UserInputService = game:GetService("UserInputService")
local MarketPlaceService = game:GetService("MarketplaceService")
local RemoteEvent = game.ReplicatedStorage.GamepassEvent
local Walking = 16
local Running = 50
local IdGamepass = 1003277775
local HasGamepass = false
RemoteEvent.OnClientEvent:Connect(function(isAllowed)
HasGamepass = isAllowed
end)
local function setupSprint(char)
local humanoid = char:WaitForChild("Humanoid")
UserInputService.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftShift and HasGamepass then
humanoid.WalkSpeed = Running
end
end)
UserInputService.InputEnded:Connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftShift then
humanoid.WalkSpeed = Walking
end
end)
end
Player.CharacterAdded:Connect(setupSprint)
if Player.Character then
setupSprint(Player.Character)
end
RemoteEvent:FireServer(IdGamepass)```
try this
I've separated stuff on a function so its easier for you to understand
** You are now Level 1! **