I originally made a script where if a player from team A captures the hill, the hill turns to the team A colour, and if a player from team B captures the hill the hill turns to team B colour.
But I want to make it so that if there are 2 players from team A, the capture time halves and the points double, and if there are 3 players from team A, the points triple etc.
Likewise if there are 2 or more players from opposing teams standing on the hill, nothing happens.
I'm unsure how to script this.
The main thing I don't know how to do is how to detect whether there are more than 1 players on the hill, and how to detect there individual teams rather than just using a generic "user.TeamColor" etc.
Or is there a completely different and better way to go about all this?
Thanks.
Here's what I have:
part = game.Workspace.zone debounce = false function onTouch(hit) local user = game.Players:GetPlayerFromCharacter(hit.Parent) if not debounce then debounce = true if user.TeamColor == game.Teams.Mayhem.TeamColor then wait(1) part.BrickColor = user.TeamColor end debounce = false end function onTouch2(hit) local user = game.Players:GetPlayerFromCharacter(hit.Parent) if not debounce then debounce = true if user.TeamColor == game.Teams.Peace.TeamColor then wait(1) part.BrickColor = user.TeamColor print(onTouch) end debounce = false end end script.Parent.Touched:connect(onTouch) script.Parent.Touched:connect(onTouch2) if onTouch and onTouch2 then do part.BrickColor = part.BrickColor.new("Yellow") end end end
Well, first of all, values are crucial to any complex game having to do with math like this. Try having a stringValue to get how many people are on the hill for each individual team. After you have done this, do some "if then" statements about how fast the team will capture the point. For example:
function onTouch(hit) local user = game.Players:GetPlayerFromCharacter(hit.Parent) if not debounce then debounce = true if user.TeamColor == game.Teams.Mayhem.TeamColor then script.parent.mayhemonhill.Value = 1 if script.Parent.mayhemonhill.Value == 1 then wait(1) part.BrickColor = user.TeamColor
and so on, if 2 mayhem people are on the point then make function again with 2 people and the wait time as 0.5!
I personally think the capture time should be longer, but that's you. If something does not work in my script, that's because i just jotted my idea down, and if you want the whole script, I would love to help if you want, and I am a somewhat seasoned scripter myself. We can work something out, and if not, just try something similar to this script. And remember, values do wonders on your games.