I need help with a "King of the Hill" script!

Hello!
Im trying to make a KOTH game. Ive read a little bit about regions and im not getting much from it. Ive looked at a thread about how I could set this up but im not able to understand it correctly.

Link

How do I make a “king of the hill” script?

Im just trying to get it up as a part that the player can walk into then a UI above the part displays the team name. Anybody able to give some tutorial links or other ways to help?

3 Likes

@Timber_Ridge could you elaborate a bit more?

and instead you could just check for distance

--pseudo code
local radius = 10
local distanceFromHill = (playerRoot.Position - hill.Position).Magnitude

--check to see if player is within distance
if(distanceFromHill <= radius) then
    --enable screen/bilboard Gui
    --give points
    --etc
else
    --disable screen/billboard Gui
    --stop giving points
    --etc
end
1 Like

Since you want to use Region3, you need to constantly loop through it.You could have a table outside of a loop that gets added onto from the instances in a region3 specified, having that contain the players currently in the region.
Then, you could have a temporary table inside of the loop that gets added to when a player is found. That table will always be reset, allowing you to add the player to the table outside of the loop for all the current players in the region if they aren’t already in the current players table.