Hello Developers! This topic is directly targetted for scripters! I am having some issues right now!
I am trying to make my stereo a WORKING one so when the person has a gamepass they can set a song by an ID and if they don’t have it, it will prompt them to buy the gamepass and then they can play on it after a re-join.
I tried Experimenting myself, tried searching YouTube and DevForums. Nothing was working/found
Another issue is that I have MUSIC AREAS. Basically if you are in Area 1, it will play a song. If you go to Area 2, it will play another song. I want to make Area 2 play the songs given on the stereo.
Just a little clarification. You said that u wanted to play a song on the stereo and the I’d of the song will be decided by the player. So what do u mean by stating that the song changes when the player goes to area 2? Will the player input another new I’d?
Run an if statement that will check if the player has your game pass by using MarketPlace:UserOwnsGamePassAsync(player.UserId, 000000). If so, then clone a tool in their backpack. Else, use MarketplaceService:PromptGamePassPurchase(player, 000000) which will ask the player if they want to buy the gamepass
I guess this is the code you want. It’s for a ClickDetector’s MouseClick function.
(The script must be inside something which parent has a ClickDetector in it, like a Part)
It works for me, i don’t know if it works for you.
script.Parent.ClickDetector.MouseClick:Connect(function(player)
local id = 8256828 --gamepass id goes here
local pl = player --set this to the player variable before using!
local mserv = game:GetService("MarketplaceService")
if mserv:UserOwnsGamePassAsync(pl.UserId, id) then
--has gamepass
else
--doesnt have gamepass, prompt purchase
mserv:PromptGamePassPurchase(pl, id)
end
end)
ClickDetectors must be inside a clickable thing, like a part.
Models aren’t clickable as they dont have a part to click.
Assuming you want it to be clickable anywhere, make an invisible part without collision, anchored, with the size of the stereo model.
Alright so I had to revoke the solution badge. Now, the problem is. How does it open the frame? Like when the person clicks the stereo IF THEY HAVE A GAMEPASS, A frame will appear.