How could I achieve Capture Objective / King of The Hill?

Is your script enabled, is it a server-script in serverscriptservice.

I have no idea then what is wrong on my part

image
it is a server script

edit:
upon testing this on a new game where the character is not a startercharacter and is r15, its printing blue no matter what now

1 Like

Wait so it only prints one team? Either blue or not blue?

In your game do characters/players/teams/parts have any custom behaviours? that might explain it.

define custom behaviours?
that might be it now that i think about it… i use acs 2.0.1

edit: that wouldn’t be it, ACS is not dependent on teams, they only have their built in fireteams for radars

Maybe try making a basepart outside the model and then set the size and cframe to that and see what happens?

I put inadvertently put a space in the game service, that’s fixed. As for the issue of it giving that other error, the code is expecting a folder in game.ReplicatedStorage called Events. It is also expecting three remote events in that folder called Score, Timer, and Winner for communication with the client. If you add those things, the messages should go away.

Like I said, I did it on the fly from memory and without the script editor intellisense, so there’s bound to be errors.

EDIT:

I forgot to mention that my code does not print. It sets the color.

EDIT 2:

I added a print statement to the code. If a team is found, it will print out the team and the brick color of the part. The first script that I gave you must to be parented to the part in question for it order to work correctly. Do not parent it to ServerScriptService.

Your code is great and all but I think it’s better if you just gave him the tools to create a king of the hill/capture objective region. Like telling him what to use, like :GetPartsInBound, because then he can actually learn how to use it. Giving him everything he needs is sort of a bit too much.

I am lost on this error now following the 2nd code you gave me

following the lines:

and

I’m not sure what could be the problem here

Fixed it. I forgot the parenthesis on os.clock(). It was about 3AM when I wrote that code.

1 Like

The hitbox thing stilll doesn’t work? I guess your cursed man.

sorry if you’re getting pinged about it,
seems like i am cursed yeah haha

No worries

It seems like im still having errors about the line 151…

this is the following line in the updated code you provided me with:

Dang he gave you over hundreds of lines of code whereas I gave you like 10… at 3AM. 100% cursed.

1 Like

On line 144, change that to the following:

	local start = os.clock()

Normally I don’t assign it there, but I have the task.wait() at the top of the loop instead of the bottom, so start actually nil right there.

@Amritss I do a lot of coding at 3AM.

1 Like

I think you are cursed too then.

After entering the zone nothing happens, no errors aswell

do i have to run some remote or something ?

The remotes aren’t strictly required. They are just to inform the players about the timer, score, and who won/tie. At this point, I have no clue. @Amritss tested it on a clean baseplate and said it is working. So you must have something else going on. What that is I have no idea.

Maybe you can test out my code on your side too and see if it works, though I have done it many times in a new baseplate and it’s absolutely fine. I’m confused.

while true do
	local zone = workspace:GetPartBoundsInBox(script.Parent.CFrame, script.Parent.Size)
	for i, part in zone do
		if part.Parent:FindFirstChildOfClass("Humanoid") then
			local plr = game.Players:GetPlayerFromCharacter(part.Parent)
			if plr.Team == game.Teams.Blue then
				print("blue")
			else
				print("not blue")
			end
		end
	end
	task.wait()
end

I just came into studio right now and wrote out a quick script, just parented the server script to the part which is going to be detected. It worked, maybe it might work @771x44