Hello, I’m trying to make a button for a 2007 style game that when you click it, it kicks you.
Basically, (sense its 2007 styled) I’m trying to make an exit button, but how would I make it kick you (with a message) when you click it?
Thanks!
Hello, I’m trying to make a button for a 2007 style game that when you click it, it kicks you.
Basically, (sense its 2007 styled) I’m trying to make an exit button, but how would I make it kick you (with a message) when you click it?
Thanks!
Well it depends whether it is a brick button or a text button. I will do both
-- Brick Button
script.Parent.ClickDetector.MouseClick:Connect(function(plr)
plr:Kick("Your Message here")
end)
-- Text Button
script.Parent.MouseButton1Click:Connect(function(plr)
plr:Kick("Your Message here")
end)
script.Parent.MouseClick:Connect(function(char)
if char then
local plr = game.Players:GetPlayerFromCharacter(chr)
plr:Kick("lol")
end
end
It is a GUI button, I assume that is the Text Button, thanks!
script.Parent.MouseClick:Connect(function(char)
if char then
local plr = game.Players:GetPlayerFromCharacter(chr)
plr:Kick(“lol”)
end
Wait where would that go?
After the text button one?
inside the clickdetector instance
? What do you mean by that, here is what my script looks like and what I’m working with.
oh right you place that in the menu and edit some of the scripts, didnt know your doing it on a gui and not a physical block
edit: also that script can work i guess
A LocalScript inside a TextButton can contain the following and work cross-platform:
local LocalPlayer = game:GetService("Players").LocalPlayer
script.Parent.Activated:Connect(function()
LocalPlayer:Kick("You have exited the game!")
end)
Hopefully this has helped!
Thanks, that works.
Also thanks for the effort @reygenne1, hopefully the game works out good well!