If I’ve helped you consider marking a solution or let me know if you have any more questions.
I said earlier, it still doesn’t work.
Time to debug then
TextButton.MouseButton1Click:Connect(function()
print("TextButton Pressed")
local OwnsGamepass = UserOwnsGamePassAsync(Player.UserId, 23171784)
if OwnsGamepass then
print("Owns Gamepass")
if KickGUI.Enabled == true then
KickGUI.Enabled = false
TextButton.Text = "ACTIVATED"
elseif KickGUI.Enabled == false then
KickGUI.Enabled = true
TextButton.Text = "Slap Out! *FOR GAMEPASS*"
end
else
print("Does not own Gamepass")
TextButton.Text = "no gamepass "
wait(1)
TextButton.Text = "Slap Out! *FOR GAMEPASS*"
end
end)
If "TextButton Pressed"
does not print it means somethings wrong with
TextButton.MouseButton1Click:Connect(function()
If the others print we simple need to look within the conditionals
Debugging it is a good idea. I also think that this is a cool concept, just be warned that its a bit OP, trollers would use it a lot.
Ok, I’ll do some debugging, but right now some errors are happenign, which isn’t allowing me, or my friend to check output, meaning for some reason, roblox just made us not the owner anymore.
You can use the search tab within the output (at the top of output tab) to look if it has printed or not
Roblox itself isn’t loading. Something has gone wrong.
Actually had that going on just now, was about to post about the problem when i saw this topic. Try pressing the play button a few times, should work eventually.
Okeh, I’ll see, when I clicked out of studio too, and went to log back in, it showed this error: Failed to fetch account info. This is just so you guys know too.
I’ll see if I can debug after this problem is fixed, since it’s not letting me log into studio.
Studio is working for me now, but its still pretty slow.
Not for me sadly, I think I’m gonna restart and see if it works or not.
Bumping this since I haven’t had an answer.
The biggest issue with your script is the fact it’s hard to maintain. You’re doing everything in a single event instead of breaking up your code into smaller more accomplishable tasks.
I know it doesn’t need to be said, but the way you shorten variables is atrocious; Mainly because there’s absolutely no reason to do so. And by no reason to do so, I mean absolutely none. Now you can probably come up with a reason to justify why you want to add shortened variables. And that’s good for you. But there absolutely no reason to do so. It just makes your code harder to maintain.
In the code posted in your OP. You were getting the Marketplace Service every time the event fired… For absolutely no reason. In a lot of the code that was offered to you by others, they made a single variable at the top of the script that maintained a reference to the Marketplace Service.
You should in turn
-
Offer the ability to those that have the game pass. (This means if you don’t have the game pass then you shouldn’t be able to use it period.)
-
Keep the game pass check inside of your code, just in case some creative client triggers the ability without actually having the game pass.
-
When they use the ability, validate the actual hit on the server. If the server says yes the player did use the slap ability and was hit by the slap ability. You can then kick them from the server.
The way you’re doing it now, AFAIK. You’re allowing people to use the ability, checking if they own it, and then kicking them from the server when they get touched.
Game passes are cached. So if you purchase them while being in-game then it would return as them not owning the game pass. However, if the player owns the game pass it should return that the player owns the game pass from the time they join.
This means if you are handling the game pass purchase in-game you should utilize the value returned from the PromptGamePassPurchaseFinished
event. As mentioned if they joined the game after purchase this wouldn’t be necessary.
I’ll fix some stuff after I’m not busy anymore right now I’m pretty busy.
The reason, I can’t just make the slapping ability a gamepass in itself, is because that is the point of the game. It’s a game where you can vibe, but if you get bored, like I do in most games like that, you can just start slapping people everywhere.
So you’re saying regardless of the game pass people can slap others. But only the kick ability activates when you own the gamepass?
If so, then what you’re describing is two different tools. The reason why you can’t make the ability a game pass in itself is that you want to combine both. So the simple solution is not to combine both.
Hm, okeh. I’ll see what I can do about that.
I need to combine both, otherwise the literal point of the game is gone.