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

Guys, I really tried, please help me with this Anti-Random kill script?

Look I really tried and got lost.. Please help me? This script is supposed to Move Players on the Teams :Assassins or guards to Citizen if someone from either team Kills an Unarmed Citizen.

I have tried may many times now I need help OR AT LEAST A HEAD START?

player = game.Players.LocalPlayer.Humanoid

function TeamColor(color)
	if TeamColor == "Bright red" and game.Teams.Assassins.ToolEquip == "YourHiddenBlade" then
		TeamColor = "Bright red"  -- And.. I'm stuck here...
	end
end


2 answers

I have made up an Example for you to reference from, but also read the ROBLOX wiki to help learn how this works.

-- To be placed inside a local script

local Player	= game.Players.LocalPlayer
local MyTeam	= Player.TeamColor
local Object	= Player.Character['Left Arm'] -- Put your part/object here.

Object.Touched:connect(function(ObjectTouched)
	if ObjectTouched.Parent:FindFirstChild('Humanoid') then
		print('Found Another Player')
		local OtherPlayer = game.Players:FindFirstChild(ObjectTouched.Parent.Name)
		if OtherPlayer.TeamColor == MyTeam then
			print("You have touched "..OtherPlayer.Name..", they are on your team!")
		else
			print("You have touched "..OtherPlayer.Name..", they arn't on your team!")
		end
	end
end)

Also to help you understand here's a hot link to the Touched section

player = game.Players.LocalPlayer.Humanoid 

Localplayer refers to the player inside Players. If you want to access their Humanoid, it should be:

 game.Players.LocalPlayer.Character.Humanoid

Also, to change a player's teamcolor, you need to modify a property called TeamColor inside the Player. Example Code:

game.Players.LocalPlayer.TeamColor == BrickColor.new("Bright red")

1 comment

0

Ah!

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