Hello! I'm making clickbutton script which can switch team and kill by click, but I don't know what can I add to kill this person whick clicks that. Any ideas?
local Player = game.Players.LocalPlayer script.Parent.MouseButton1Click:connect(function() Player.Team = game:GetService("Teams").Guest; end)
Hello! There are a few ways you could go about this actually.
The first method is using Humanoid:LoadCharacter()
local Player = game:GetService("Players").LocalPlayer local humanoid = Player.Character:FindFirstChild("Humanoid") humanoid:LoadCharacter() --This simply respawns the character
The second method you can use is changing the humanoids health to 0
local Player = game:GetService("Players").LocalPlayer local humanoid = Player.Character:FindFirstChild("Humanoid") humanoid.Health = "0" --This will kill the player!
The last method that I know of is using the humanoid TakeDamage function
local Player = game:GetService("Players").LocalPlayer local humanoid = Player.Character:FindFirstChild("Humanoid") humanoid:TakeDamage(100) --This will damage the player, taking away ultimately health, pretty much method 2.
I hope this was able to help you! Any questions? Comment down below, and I'll be glad to help!
Don't forget to mark as the solution if this helps you!