Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Players = game:GetService("Players")
- local ChatService = game:GetService("Chat")
- local player = Players.LocalPlayer
- local char = player.Character or player.CharacterAdded:Wait()
- local hrp = char:WaitForChild("HumanoidRootPart")
- local humanoid = char:WaitForChild("Humanoid")
- local TARGET_ANIMATION_ID = "rbxassetid://12351854556"
- local CHAT_MESSAGE = "simon says counter"
- local detectionRadius = 10
- local hasSpoken = false
- game:GetService("RunService").RenderStepped:Connect(function()
- local conditionMet = false
- for _, otherPlayer in pairs(Players:GetPlayers()) do
- if otherPlayer ~= player and otherPlayer.Character and otherPlayer.Character:FindFirstChild("HumanoidRootPart") and otherPlayer.Character:FindFirstChild("Humanoid") then
- local otherHRP = otherPlayer.Character.HumanoidRootPart
- if (otherHRP.Position - hrp.Position).Magnitude <= detectionRadius then
- local otherHumanoid = otherPlayer.Character.Humanoid
- local tracks = otherHumanoid:GetPlayingAnimationTracks()
- for _, track in pairs(tracks) do
- if track.Animation and track.Animation.AnimationId == TARGET_ANIMATION_ID then
- conditionMet = true
- break
- end
- end
- end
- end
- if conditionMet then break end
- end
- if conditionMet and not hasSpoken then
- game.ReplicatedStorage.DefaultChatSystemChatEvents.SayMessageRequest:FireServer(CHAT_MESSAGE, "All")
- hasSpoken = true
- end
- if not conditionMet then
- hasSpoken = false
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement