So, I have made a gamepass that if you have the gamepass, and have clicked the textbutton, it will kick them. Now my problem is, I can’t figure out how I would go about the Activation/Deactivation part.
Yes, I would like to know when the button has been clicked, and when its clicked again, to deactivate it, so that they can choose if they want to kick. So, lets say they’re playing with their friend and don’t want to kick them. Then they just don’t click. If they want to kick someone, they’ll click, and it will stay on. When they want to turn it off again, they will click it again to turn it off. I also have to go afk for a bit so I’ll probably respond a bit late.
I just realized I’m an idiot. Here’s the scripts though if anyone wants them for their own problem.
Here’s server script for kicking. Put in only a snippet because I don’t want anyone copying it.
if Humanoid.Health < 1 then
Player.leaderstats.moneys.Value = Player.leaderstats.moneys.Value + 50
if Player and mps:UserOwnsGamePassAsync(Player.UserId,23171784) then
if game.StarterGui.KickGUI.Enabled == false then
local plr = game.Players:GetPlayerFromCharacter(Hit.Parent)
plr:Kick("You've been kicked by someone who wasted their money")
else
print("not on")
end
Here is the local script handling the enabled and click detection:
local mps = game:GetService("MarketplaceService")
script.Parent.MouseButton1Click:Connect(function(plr)
if plr and mps:UserOwnsGamePassAsync(plr.UserId, 23171784) then
if game.StarterGui.KickGUI.Enabled == true then
game.StarterGui.KickGUI.Enabled = false
script.Parent.Text = "ACTIVATED"
elseif game.StarterGui.KickGUI.Enabled == false then
game.StarterGui.KickGUI.Enabled = true
script.Parent.Text = "Slap Out! *FOR GAMEPASS*"
end
else
script.Parent.Text = "no gamepass "
wait(1)
script.Parent.Text = "Slap Out! *FOR GAMEPASS*"
end
end)