Here is the client script

LocalPlayer = game.Players.LocalPlayer
Character = LocalPlayer.Character
ButtonPressed = false

script.Parent.Activated:Connect(function()
	if ButtonPressed == false then
		if game.MarketplaceService:PlayerOwnsAsset(LocalPlayer, 5010729) then
			
			ButtonPressed = true
			script.Parent.Text = ("Stop Torque")
			game.ReplicatedStorage.RemoteGamepassTorque:FireServer(Character, true)
			
		else
			
			game.MarketplaceService:PromptGamePassPurchase(LocalPlayer, 5010729)
			
		end
	else
		if game.MarketplaceService:PlayerOwnsAsset(LocalPlayer, 5010729) then
			
			ButtonPressed = false
			script.Parent.Text = ("Start Torque")
			game.ReplicatedStorage.RemoteGamepassTorque:FireServer(Character, false)
			
		else
			
			game.MarketplaceService:PromptGamePassPurchase(LocalPlayer, 5010729)
			
		end
	end
end)

Here is the server script.

game.ReplicatedStorage.RemoteGamepassTorque.OnServerEvent:Connect(function(Player, Character, Value)
	if Value == true then
		
		Torque.Torque = Vector3.new(100000,100000,100000)
		Torque.Attachment0 = Character.Head.HatAttachment
		Torque.Parent = Character.Head
		
	else
		
		GamepassTorque.Parent = nil
		
	end
end)

4 comments

0

Just a guess, but I don't think the client can access marketplaceservice. Try moving all of the if statements to the server script.

0

@ above is correct

0

I'll try that!

0

Actually the MarketplaceService CAN be accessed from the client. If you're checking for a game pass though, use UserOwnsGamePassAsync,and use from server and instead of the player it's their UserId