There’s a marker that’s suppose to be visible every time a unit is doing a action.
Attempted part of LocalScript
while true do
wait(0.1)
local hum = Unit:WaitForChild("Humanoid")
if hum.MoveDirection == Vector3.new(0, 0, 0) and hum:GetState() ~= Enum.HumanoidStateType.Jumping and hum:GetState() ~= Enum.HumanoidStateType.Running and hum:GetState() ~= Enum.HumanoidStateType.Physics then
for _, track in ipairs(hum:GetPlayingAnimationTracks()) do
if track.IsPlaying then
IdleNotification.Visible = false
else
IdleNotification.Visible = true
end
end
IdleNotification.Visible = true
end
end
Entire LocalScript
local player = game.Players.LocalPlayer
local Team = player.Team
local Frames = script.Parent
local CamBlock = workspace:WaitForChild("CamBlock")
local TroopCollection = workspace.Enviroment.Teams[Team.Name].Troops
local function createButtonForUnit(Unit)
local troop_button = Instance.new("ImageButton")
troop_button.Name = "Troop_Button"
troop_button.BorderSizePixel = 0
troop_button.BackgroundTransparency = 1
troop_button.Image = "rbxassetid://3270704442"
local IdleNotification = Instance.new("ImageLabel",troop_button)
IdleNotification.Name = "IdleNotification"
IdleNotification.BorderSizePixel = 0
IdleNotification.Position = UDim2.new(0.7,0,0,0)
IdleNotification.Size = UDim2.new(0.4,0,0.4,0)
IdleNotification.Image = "rbxassetid://3301006650"
IdleNotification.BackgroundTransparency = 1
IdleNotification.Visible = true
troop_button.Parent = Frames
troop_button.MouseButton1Click:connect(function() -- camera goes to head
CamBlock.Position = Unit.Head.Position + Vector3.new(0,30,0)
end)
--[[while true do ATTEMPTED PART
wait(0.1)
local hum = Unit:WaitForChild("Humanoid")
if hum.MoveDirection == Vector3.new(0, 0, 0)
and hum:GetState() ~= Enum.HumanoidStateType.Jumping and hum:GetState() ~= Enum.HumanoidStateType.Running and hum:GetState() ~= Enum.HumanoidStateType.Physics then
for _, track in ipairs(hum:GetPlayingAnimationTracks()) do
if track.IsPlaying then
IdleNotification.Visible = false
else
IdleNotification.Visible = true
end
end
IdleNotification.Visible = true
end
end--]]
end
local function unitDied()
print("im G O N E")
end
TroopCollection.ChildAdded:Connect(createButtonForUnit)
TroopCollection.ChildRemoved:Connect(unitDied)
for _, Unit in pairs(TroopCollection:GetChildren()) do
createButtonForUnit(Unit)
end