i want it to check if they own the gamepass immediatly not just after rejoining the script is:
local Players = game:GetService(“Players”)
local MarketPlaceService = game:GetService(“MarketplaceService”)
Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
local Humanoid = Character:WaitForChild(“Humanoid”)
local GamepassID = 268694445
local Multiplier = 1.5
if MarketPlaceService:UserOwnsGamePassAsync(Player.UserId, GamepassID) then
Humanoid.WalkSpeed = Humanoid.WalkSpeed * Multiplier
where exactly would i put this would i use it in
local Players = game:GetService(“Players”)
local MarketPlaceService = game:GetService(“MarketplaceService”)
Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
local Humanoid = Character:WaitForChild(“Humanoid”)
local GamepassID = 268694445
local Multiplier = 20
if MarketPlaceService.PromptGamePassPurchaseFinished:Connect(function(player, gamePassId, wasPurchased)
then
Humanoid.WalkSpeed = Humanoid.WalkSpeed * Multiplier
end
end)
ok i have done it now for anyone wanting the full script it is:
local Players = game:GetService(“Players”)
local MarketplaceService = game:GetService(“MarketplaceService”)
Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
local Humanoid = Character:WaitForChild(“Humanoid”)
local GamepassID = 268694445
local Multiplier = 20
local function HandleGamePassPurchase(player, gamePassId, wasPurchased)
if gamePassId == GamepassID and wasPurchased then
Humanoid.WalkSpeed = Humanoid.WalkSpeed * Multiplier
end
end
MarketplaceService.PromptGamePassPurchaseFinished:Connect(HandleGamePassPurchase)
end)