Im trying to set up a 2x speed gamepass that essentially gives you 2x the points in the leaderstat & also makes you go 2x as fast as other players that dont have the pass, ive tried basically everything but its clear im missing a big piece of the script or something, can someone help me out? But it is not showing that it is giving me 2x in the leaderstat nor is it doing it in game
local Players = game:GetService("Players")
local MPS = game:GetService("MarketplaceService")
Players.PlayerAdded:Connect(function(Plr)
Plr.CharacterAdded:Connect(function(char)
local Humanoid = char:FindFirstChild("Humanoid")
if MPS:UserOwnsGamePassAsync(Plr.UserId, 2989290492) then
Humanoid.WalkSpeed = game.StarterPlayer.CharacterWalkSpeed * 2
end
end)
end)
local Players = game:GetService("Players")
local MPS = game:GetService("MarketplaceService")
Players.PlayerAdded:Connect(function(Plr)
Plr.CharacterAdded:Connect(function(char)
local Humanoid = char:FindFirstChild("Humanoid")
if MPS:UserOwnsGamePassAsync(Plr.UserId, 2989290492) then
Humanoid.WalkSpeed = game:GetService("StarterPlayer").CharacterWalkSpeed.Value * 2
end
end)
end)
The game pass does not exist as stated. Off sale does not correlate to the situation of it not being accessible through page. You probably mistake it for a developer product.
Are you trying to do this with a LocalScript? I tried this with a server script and it worked. If you were doing a LocalScript change it to a Server Script and place it in ServerScriptService.
local Players = game:GetService("Players")
local MPS = game:GetService("MarketplaceService")
Players.PlayerAdded:Connect(function(Plr)
Plr.CharacterAdded:Connect(function(char)
local Humanoid = char:FindFirstChildOfClass("Humanoid")
if MPS:UserOwnsGamePassAsync(Plr.UserId, YOURIDHERE) then
Humanoid.WalkSpeed = Humanoid.WalkSpeed * 2
end
end)
end)