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

How can I make certain scripts for certain teams?

I have Werewolves vs Humans(or Vampires.. doesn't matter) And I got AWESOME animations for both teams. I ONLY want the WereWolf team to have certain "Local" scripts, with the animations as a child. And Same for the other team. I don't know how to do that. I've tried. Mind helping me out?

wait(2)

repeat
    wait()
until game.Players.LocalPlayer

player = game.Players.LocalPlayer
character = player.Character
if not character then
    character = player.CharacterAdded:wait()
end

Mouse = player:GetMouse()
humanoid = character:WaitForChild("Humanoid")
s = humanoid:LoadAnimation(game.StarterPack.RunAnimScrip.Animation)


Mouse.KeyDown:connect(function(key)
     key = string.lower(key)
   if string.byte(key) == 48 and player.TeamColor == "Bright blue Team" then
        s:Play()
        humanoid.WalkSpeed = 25
    end
end)


Mouse.KeyUp:connect(function(key)
    key = string.lower(key)
if string.byte(key) == 48 and player.TeamColor == "Bright blue Team" then
        s:Stop()
        humanoid.WalkSpeed = 16
    end
end)

3 answers

✓ Accepted answer

It's Very Simple

Well, it's really easy and useful to use, you can use an if function, to check if a player is wearing a certain item, doing a certain action(like jumping or walking), etc.

The Code

You can check if a player is on a team of a sort, like this!

if game.Players.LocalPlayer.TeamColor == BrickColor.new('Really Red') then--change the Really Red to the color of your team.
--code
end

So...

Hopefully this helped you, if you have any more questions, just message me on Roblox.

GreekGodOfMLG

P.S

The edited version of the script you wanted and where to implant it.


wait(2)
repeat
 wait()
until game.Players.LocalPlayer
	player = game.Players.LocalPlayer
	character = player.Character
	if not character then
	    character = player.CharacterAdded:wait()
	end
Mouse = player:GetMouse()
humanoid = character:WaitForChild("Humanoid")
s = humanoid:LoadAnimation(game.StarterPack.RunAnimScrip.Animation)
ouse.KeyDown:connect(function(key)
    key = string.lower(key)
  if player.TeamColor = BrickColor.new ('Bright Blue') then--Change it to the team color you want.
humanoid.WalkSpeed = 25
    end
end)
Mouse.KeyUp:connect(function(key)
   key = string.lower(key) if string.byte(key) == 48 and player.TeamColor == "Bright blue Team" then
s:Stop()
humanoid.WalkSpeed = 16
end
end)

6 comments

0

So I just replace my Team Color line with that? Also, How would I fit that in with my IF Key == 48 Line?

0

I will edit my answer to help with your code :)

0

WOOPS accidently deleated your == 48 line, just insert it before player.TeamColor, and it should work just fine.

0

Thank you

0

Accept my answer :D

0

Sorry, totally forgot. I was editting

Well, I'm not the best scripter, but I think I might know how to solve this one. You'd have to figure out what team a player is on by:

game.Players.LocalPlayer.TeamColor --Not completing it, cause I don't know how to....

Then make it so that If a player is on the Black team(Dark for werewolf?), then that person would get these animations, and if a player was on the Red team(Vampires?), they'd get the other animations.

Correct me if i'm wrong... :P

This is not what I ment sorry can't help ya, matter of fact I am terrible at scripting!

3 comments

0

Seriously, this isn't forums. If you don't know or won't try to help, don't bother commenting. Sorry for my rudeness.

0

kk :) lol raged.

0

might be if you put the script you want in one team (make two script's and put them in the teams so one script in red and one script in blue)

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