My goal with this system is that after certain points are achieved the Hardpoint would then change to a different one. Meaning that whoever fills up the point first is the one who captures the hardpoint and move onto the next. How would i go about that?
I saw a script and tried modifying it but i just cant understand some of the context like how would i shuffle the Hardpoints. ive thought of putting them in a table but i havent tried it just yet. I wanted to know about how do i go about the capturing function and captured function of the script and stuff like that.
so far ive made this but i dont know how to make it work as the one before this is already in a round system and i just wanted to make a script from it.
--Folders
local hardPointFolder = workspace:WaitForChild("HardPointFolder")
local events = RS:WaitForChild("Events")
--Point Stuff
local activePoint = nil
local captured = false
local capturing = false
local captureProgress = 0
local touched = nil
local timeRemaining = 0
local curCap = nil
local capturingPlayersCount = 0
--config
local config = require(script.Config)
--Events
local pointChanged = events:WaitForChild("PointChanged")
local pointCaptured = events:WaitForChild("PointCaptured")
--tables
local queue = {}
--functions
local function capturing()
while wait() do
task.wait(1.5)
captureProgress = captureProgress + 1
end
end
local function activepoint(point)
if activePoint then
activePoint.Trigger.Transparency = 1
activePoint.Trigger.BrickColor = BrickColor.new("White")
activePoint.Display.BillboardGui.Title.BackgroundColor3 = BrickColor.new("White").Color
activePoint.Display.BillboardGui.Enabled = false
end
if touched then
--touched:Disconnect()
capturing = true
end
activePoint = point
activePoint:WaitForChild("trigger").Transparency = 0
activePoint.Display.BillboardGui.Enabled = true
timeRemaining = config.Time
curCap = point
local db = true
touched = activePoint.Trigger.Touched:Connect(function(what)
if what and game.Players:FindFirstChild(what.Parent.Name) and db then
local plr = game.Players[what.Parent.Name]
local hum = plr.Character:FindFirstChild("Humanoid")
if hum and capturing then
db = false
activePoint:WaitForChild("Trigger").BrickColor = BrickColor.new("Neon green")
capturing()
if captureProgress == 5 then
captured = true
db = true
end
end
end
end)
end
local function buildQueue()
queue = {}
for _, v in ipairs(hardPointFolder:GetChildren()) do
if v then
table.insert(queue,v)
end
end
end
local function SelectPoint()
pointChanged:FireAllClients()
local list = {}
for _, v in ipairs(hardPointFolder:GetChildren()) do
if v and v ~= curCap then
table.insert(list,v)
end
end
local index = math.random(1, #list)
activePoint(list[index])
end
i dont want a script. Just something that will help me comprehend the concept and progress behind it will be enough for me and continue to improve on it.
Well, you can make a hardpoint system by this:
First, I assume that you have 2 or more teams.
What you can do is have a .heartbeat event which checks all hardpoints in the hardpointsfolder.
Now, you may ask how to check these all you need to is using :GetPartBoundsInBox method this allow you to check all players in a hardpoint. You can use a while loop. Now les’t say this function decected 2 players from diffirent teams what you can do is make the hardpoint to get contested. I prefer you to read this after that for capturing part you should give like +1 to your capture system per heartbeat and if you have progress bar it will increase.
So this is all I can prefer. You should research about OOP and OverlapParams for better performance and organization
Hey i have a question as im making this i realized im making the hardpoint system seperate from a round system. So i wondered how would i make it work. Should i integrate the hardpoint system to a round system? would that make it easier to make?
i was also thinking if i could put the point tracker in an int value instead of making a leaderstats for it and resetting the value to zero once a point is captured. would that have a huge difference? Would the leaderstats be better?
you should initialize the hardpoint system when you started next round in the game so it will be diffirent script from main one for this make hardpoint system a module script and intialize it when you need once it is initialized it will start checking for points and etc. As I said you can do this by doing booth modular programming and OOP. So, yes you should make them diffirent scripts and use them when you need so it will be better at performance otherwise when you need to do bug fix or update it will be hard to edit since they are at 2 scripts.
Second Question
You should make a point tracker for zones and connect & disconnect it when you do not need that point not need to tracked or tracked. With int values you can control those better however you should have it stored at server for security reasons and if you meant leaderstats at player instance No, do make it like that since it needs to be stored as server side not local.
Im using zoneplus for detecting the player in the hardpoint but its just not working. Its not complete yet im just seeing if i can shuffle the hardpoints and if a player walks in it it changes to the other but the zoneplus isnt working for some reason. The zoneplus event was in the function before but it still didnt work so i tried making a tracker for the current Hardpoint and it still doesnt work.Why?
local RS = game:WaitForChild("ReplicatedStorage")
--Modules
local zone = require(RS:WaitForChild("Modules"):WaitForChild("Zone"))
local ZonePlrs = require(game.ServerScriptService.Script.PlrsInZone)
local config = script.Config
--Folders
local PointsFolder = workspace.HardPointFolder
local events = RS:WaitForChild("Events")
--Events
local pointChanged = events:WaitForChild("PointChanged")
local pointCaptured = events:WaitForChild("PointCaptured")
--Points
local points = require(game.ReplicatedStorage.Points)
--Points Vars
local activePoint = nil
local captured = false
local capturing = false
local captureProgress = 0
local curPoint = nil
local capturingPlayersCount = 0
local newPoint = nil
local function activatePoint(point)
if activePoint and captured then
activePoint.Trigger.Transparency = 1
activePoint.Trigger.BrickColor = BrickColor.new("White")
activePoint.Display.BillboardGui.Title.BackgroundColor3 = BrickColor.new("White").Color
activePoint.Display.BillboardGui.Enabled = false
capturing = false
end
activePoint = point
activePoint:WaitForChild("Trigger").Transparency = 0
activePoint.Display.BillboardGui.Enabled = true
curPoint = point
newPoint = zone.new(point:WaitForChild("Trigger"))
print("new point assigned")
end
local function SelectPoint()
local list = {}
for _, v in ipairs(PointsFolder:GetChildren()) do
if v and v ~= curPoint then
table.insert(list,v)
end
end
local index = math.random(1, #list)
activatePoint(list[index])
end
SelectPoint()
newPoint.playerEntered:Connect(function(plr)
print(plr .. ' has entered')
end)```
what if i use the zoneplus module i heard it’s really handy and would be more easy to use but im having a bit of a trouble for it i got the shuffling down but the capturing not quite. Im i perhaps integrating it wrong?