Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Tag script is not killing on touch at all?

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"

script.Parent.Handle.Touched:Connect(function(hit)
	local player = game.Players:GetPlayerFromCharacter(hit.Parent)
	print(player)
	if player and not player.TeamColor == BrickColor.new("Really red") then
		hit.Parent:BreakJoints()
	end
end)

PLEASE HELP!

2 answers

✓ Accepted answer

Super simple fix. Instead of doing all of that, you can just easily kill the player.

Code:

local Handle = script.Parent.Handle --reference variable for the handle
local Player = game.Players.LocalPlayer --reference variable for your player

Handle.Touched:Connect(function(Hit) --if the handle gets touched, assign the touched thing to Hit
	local Humanoid = Hit.Parent:FindFirstChild("Humanoid") --sets Humanoid equal to the humanoid
	Humanoid.Health = 0 --sets the humanoid health to 0, if touched

	if Hit.Parent == Player then --if the parent is your localplayer, then (basically so it doesnt kill you)
		return --return, which basically ignores everything else, and reruns
	end
end)

I tested this, and it worked. Hopefully you understand the code, and have a good day.

3 comments

0

You forgot to mention the team. So, 'if player.Team ~= game.Teams.["YOURTEAMNAME"] then'. Just adding to your post since I realized you forgot that.

0

I edited it to fit some more, and added the team. Thank you so much!

0

No problem.

Have you tried to put the Humanoid's health to 0?

1 comment

0

Still doesn't work.

This discussion is preserved as it was. New answers, comments, and votes are closed.