Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

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

Asked by 9 years ago

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

Log in to vote
1
Answered by
Soliate 80
9 years ago

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

Ad
Log in to vote
0
Answered by
Validark 1580 Snack Break Moderation Voter
9 years ago
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")
0
Ah! 789zaya 0 — 9y

Answer this question