Currently I am making a king system where you have to touch a part. When there is no tool being held and player is standing still it counts, but when a tool is held and a player is standing still it stops. Please help
local function awardKingSeconds()
for _, throne in pairs(kingThrones:GetChildren()) do
if throne:HasTag("KingSpot") then
-- Get everything touching the throne
local touchingParts = workspace:GetPartsInPart(throne)
local playersRewarded = {} -- Prevent double-counting if multiple limbs touch
for _, part in pairs(touchingParts) do
-- Check if part.Parent is the character OR if part.Parent.Parent is (for tools)
local character = part.Parent
local player = game.Players:GetPlayerFromCharacter(character)
-- If not found, check one level up (for tool parts)
if not player then
character = part.Parent.Parent
player = game.Players:GetPlayerFromCharacter(character)
end
if player and not playersRewarded[player] then
local leaderstats = player:FindFirstChild("leaderstats")
local kingSeconds = leaderstats and leaderstats:FindFirstChild("Seconds Ruled")
if kingSeconds then
kingSeconds.Value += 1
playersRewarded[player] = true
player:AddTag("King")
end
end
end
-- Remove King tag from players no longer on throne
for _, player in pairs(game.Players:GetPlayers()) do
if player:HasTag("King") and not playersRewarded[player] then
player:RemoveTag("King")
end
end
end
end
end
(ignore it not counting anymore I had an error)