Hi, I have a tag game and the script that I use just does not work at all. It prints the player but the script just won't break joints. The tagger team color is "Really Red"
1 | script.Parent.Handle.Touched:Connect( function (hit) |
2 | local player = game.Players:GetPlayerFromCharacter(hit.Parent) |
3 | print (player) |
4 | if player and not player.TeamColor = = BrickColor.new( "Really red" ) then |
5 | hit.Parent:BreakJoints() |
6 | end |
7 | end ) |
PLEASE HELP!
Super simple fix. Instead of doing all of that, you can just easily kill the player.
Code:
01 | local Handle = script.Parent.Handle --reference variable for the handle |
02 | local Player = game.Players.LocalPlayer --reference variable for your player |
03 |
04 | Handle.Touched:Connect( function (Hit) --if the handle gets touched, assign the touched thing to Hit |
05 | local Humanoid = Hit.Parent:FindFirstChild( "Humanoid" ) --sets Humanoid equal to the humanoid |
06 | Humanoid.Health = 0 --sets the humanoid health to 0, if touched |
07 |
08 | if Hit.Parent = = Player then --if the parent is your localplayer, then (basically so it doesnt kill you) |
09 | return --return, which basically ignores everything else, and reruns |
10 | end |
11 | end ) |
I tested this, and it worked. Hopefully you understand the code, and have a good day.
Have you tried to put the Humanoid's health to 0?