I have made it so when you press sprint you run, but I can't figure out how to put it into a game pass so they must own it to be able to sprint. https://gyazo.com/61e8f5371ff50f0c5d14cac3822c1d2a
That is my sprint script if someone could help me out that would be great! Thanks in advance!
Just add a bool value in them called "CanSprint" or something then create a script not local and add this
local ID = 103728213 --the id to the gamepass game.Players.PlayerAdded:connect(function(plr) local CanSprint = plr:FindFirstChild("CanSprint") if CanSprint != nil then if game:GetService("GamePassService"):PlayerHasPass(player, id) then CanSprint.Value = true end end end)
and if they don't just add this
local ID = 103728213 --the id to the gamepass game.Players.PlayerAdded:connect(function(plr) local CanSprint = plr:FindFirstChild("CanSprint") if CanSprint != nil then if game:GetService("GamePassService"):PlayerHasPass(player, id) then CanSprint.Value = true else CanSprint.Value = true end end end)
and in your sprint script just add before the KeyDown function
local CanSprint = plr:FindFirstChild("CanSprint")
and then after it add
if CanSprint != nil then --Checks if it was found if CanSprint.Value == true then --code end end
And thats it!
Edit: I would suggest using UserInputService to check for keydown its better because Mouse.KeyDown is depricated!
To use UserInputService for your thing you just do this
local UserInputService = game:GetService("UserInputService") UserInputService.InputBegan:Connect(function(key) if key.KeyCode == Enum.KeyCode.LeftShift then --sprint code end end) UserInputService.InputEnded:Connect(function(key) if key.KeyCode == Enum.KeyCode.LeftShift then --sprint code end end)