Code:
local Zone = require(game:GetService("ReplicatedStorage"):WaitForChild("Zone"))
local CenterPoint = script.Parent.Center
local LeftPoint = script.Parent.Left
local RightPoint = script.Parent.Right
local CenterClaimArea = Zone.new(CenterPoint.Detector)
local Config = {
TimeToClaim = 20;
ClaimReward = 500;
TimePerReward = 300; -- 5 mins in seconds
}
local TS = game:GetService("TweenService")
CenterClaimArea.playerEntered:Connect(function(plr)
if CenterPoint.Claimed.Value == false then
local Change = {Position = CenterPoint.DisplayBottomPos.Position}
TS:Create(CenterPoint.Display, TweenInfo.new((Config.TimeToClaim / 2), Enum.EasingStyle.Linear, Enum.EasingDirection.InOut), Change):Play()
task.wait((Config.TimeToClaim / 2))
CenterPoint.Display.OwnerPic.Texture = game:GetService("Players"):GetUserThumbnailAsync(plr.UserId, Enum.ThumbnailType.AvatarBust, Enum.ThumbnailSize.Size180x180)
local Change2 = {Position = CenterPoint.DisplayTopPos.Position}
TS:Create(CenterPoint.Display, TweenInfo.new((Config.TimeToClaim / 2), Enum.EasingStyle.Linear, Enum.EasingDirection.InOut), Change2):Play()
task.wait((Config.TimeToClaim / 2))
CenterPoint.Claimed.Value = true
CenterPoint.Claimed.Owner.Value = plr.Name
else
CenterPoint.Claimed.Value = false
CenterPoint.Claimed.Owner.Value = ""
local Change = {Position = CenterPoint.DisplayBottomPos.Position}
TS:Create(CenterPoint.Display, TweenInfo.new((Config.TimeToClaim / 2)),Change):Play()
task.wait((Config.TimeToClaim / 2))
CenterPoint.Display.OwnerPic.Texture = game:GetService("Players"):GetUserThumbnailAsync(plr.UserId, Enum.ThumbnailType.AvatarBust, Enum.ThumbnailSize.Size180x180)
local Change2 = {Position = CenterPoint.DisplayTopPos.Position}
TS:Create(CenterPoint.Display, TweenInfo.new((Config.TimeToClaim / 2)),Change2):Play()
task.wait((Config.TimeToClaim / 2))
CenterPoint.Claimed.Value = true
CenterPoint.Claimed.Owner.Value = plr.Name
end
end)
CenterClaimArea.playerExited:Connect(function(plr)
end)
local CS = game:GetService("CollectionService")
while true do
task.wait(Config.TimePerReward)
for _, Owner in pairs(CS:GetTagged("PointOwner")) do
if game.Players:FindFirstChild(Owner.Value) then
game.Players:FindFirstChild(Owner.Value).leaderstats.Tokens.Value += Config.ClaimReward
end
end
end
So I am coding a system where you capture a point to earn cash every 5 mins but I want to make it so if a player comes on the platform of the flag then the claimer who is claiming the flag has to eliminate that player or make that player leave the point to proceed the claim