Hi, I am Goobye and I am trying to put gamepass in this input began ie if the player has that gamepass it releases this function from user input began

This is my script :

local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local uis = game:GetService("UserInputService") 
local passId = 1622040008

uis.InputBegan:Connect(function(key)
	if game.GamePassService:PlayerHasPass(player ,passId) then return end
	if key.KeyCode == Enum.KeyCode.V then
		wait(1)
		game.ReplicatedStorage.WingsofFreedom:Clone().Parent = char
		local fr = Instance.new("Fire", char.UpperTorso)
		fr.Heat = 20
		fr.Size = 10
		fr.Color = Color3.new(102,0,0)
		char.Humanoid.MaxHealth = 500
		char.Humanoid.Health = 500
	end
end)

If needed this is the button script to buy this gamepass

local Player = game.Players.LocalPlayer
 
script.Parent.MouseButton1Click:connect(function()
 game.MarketplaceService:PromptPurchase(Player, 1622040008)
end)

3 comments

0

You're returning if the player does have the gamepass. So if the player has it, that means the function won't run. Is that what you want?

0

sim

0

yes man