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

How can I make certain scripts for certain teams?

Asked by 9 years ago

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

Log in to vote
2
Answered by 9 years ago

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)
0
So I just replace my Team Color line with that? Also, How would I fit that in with my IF Key == 48 Line? james24dj 90 — 9y
0
I will edit my answer to help with your code :) GreekGodOfMLG 244 — 9y
0
WOOPS accidently deleated your == 48 line, just insert it before player.TeamColor, and it should work just fine. GreekGodOfMLG 244 — 9y
0
Thank you james24dj 90 — 9y
View all comments (2 more)
0
Accept my answer :D GreekGodOfMLG 244 — 9y
0
Sorry, totally forgot. I was editting james24dj 90 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

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

Log in to vote
-5
Answered by 9 years ago

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

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. james24dj 90 — 9y
0
kk :) lol raged. matthewwilson23 0 — 9y
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) matthewwilson23 0 — 9y

Answer this question