local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local SpillCleanedEvent = ReplicatedStorage:WaitForChild("SpillCleaned")
local CLEANER_TEAM_NAME = "Cleaner [์ฒญ์๋ถ]"
local TARGET_GROUP_ID = 12475608
local TARGET_RANK = 222
local MOP_ANIMATION_ID = "http://www.roblox.com/asset/?id=126407570972225"
local eventClean = ReplicatedStorage:WaitForChild("eventclean") -- ์๋ฒ๋ก ์ด๋ฒคํธ๋ฅผ ๋ณด๋ผ ์ด๋ฒคํธ
local function SetupSpill(spill)
local prompt = spill:WaitForChild("ProximityPrompt")
local lock = false
prompt.Triggered:Connect(function()
if lock then return end
local character = player.Character or player.CharacterAdded:Wait()
local tool = character:FindFirstChildOfClass("Tool")
if not tool or tool.Name ~= "Mop" then
return
end
local isCleaner = player.Team and player.Team.Name == CLEANER_TEAM_NAME
local isInGroup = player:IsInGroup(TARGET_GROUP_ID) and player:GetRankInGroup(TARGET_GROUP_ID) == TARGET_RANK
if isCleaner or isInGroup then
lock = true
-- Spill์ ์ฒญ์ํ๋ ์์ฒญ์ ์๋ฒ๋ก ๋ณด๋
eventClean:FireServer(spill)
print("์์ฒญ ๋ณด๋")
prompt.Enabled = false
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:FindFirstChildOfClass("Humanoid")
local animator = humanoid and humanoid:FindFirstChildOfClass("Animator")
local animationTrack
if animator then
local anim = Instance.new("Animation")
anim.AnimationId = "http://www.roblox.com/Asset?ID=126407570972225" -- โ ์ด๋ ๊ฒ ๊ณ ์ณ์ผ ํจ
animationTrack = animator:LoadAnimation(anim)
animationTrack:Play()
task.delay(3, function()
if animationTrack then
animationTrack:Stop()
end
end)
end
while spill and spill.Size.Magnitude > 0.2 do
spill.Size -= Vector3.new(0.02, 0.02, 0.02)
task.wait(0.01)
end
if spill then
game.ReplicatedStorage.SpillCleaned:FireServer(player)
spill:Destroy()
end
end
end)
end
-- ์ฒ์๋ถํฐ ์๋ ๊ฒ๋ค ์ฐ๊ฒฐ
for _, spill in ipairs(workspace.SpillData.GlobalSpills:GetChildren()) do
SetupSpill(spill)
end
-- ์๋ก ์๊ธฐ๋ ๊ฒ๋ค๋ ์ฐ๊ฒฐ
workspace.SpillData.GlobalSpills.ChildAdded:Connect(function(spill)
SetupSpill(spill)
end)
Local script
Requests event from eventClean:FireServer(spill)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local SpillCleanedEvent = ReplicatedStorage:WaitForChild("SpillCleaned")
local CLEANER_TEAM_NAME = "Cleaner [์ฒญ์๋ถ]"
local TARGET_GROUP_ID = 12475608
local TARGET_RANK = 222
local MOP_ANIMATION_ID = "http://www.roblox.com/asset/?id=126407570972225"
local eventClean = ReplicatedStorage:WaitForChild("eventclean") -- ์๋ฒ๋ก ์ด๋ฒคํธ๋ฅผ ๋ณด๋ผ ์ด๋ฒคํธ
local function SetupSpill(spill)
local prompt = spill:WaitForChild("ProximityPrompt")
local lock = false
prompt.Triggered:Connect(function()
if lock then return end
local character = player.Character or player.CharacterAdded:Wait()
local tool = character:FindFirstChildOfClass("Tool")
if not tool or tool.Name ~= "Mop" then
return
end
local isCleaner = player.Team and player.Team.Name == CLEANER_TEAM_NAME
local isInGroup = player:IsInGroup(TARGET_GROUP_ID) and player:GetRankInGroup(TARGET_GROUP_ID) == TARGET_RANK
if isCleaner or isInGroup then
lock = true
-- Spill์ ์ฒญ์ํ๋ ์์ฒญ์ ์๋ฒ๋ก ๋ณด๋
eventClean:FireServer(spill)
print("์์ฒญ ๋ณด๋")
prompt.Enabled = false
--local character = player.Character or player.CharacterAdded:Wait()
--local humanoid = character:FindFirstChildOfClass("Humanoid")
--local animator = humanoid and humanoid:FindFirstChildOfClass("Animator")
--local animationTrack
--if animator then
-- local anim = Instance.new("Animation")
-- anim.AnimationId = "http://www.roblox.com/Asset?ID=126407570972225" -- โ ์ด๋ ๊ฒ ๊ณ ์ณ์ผ ํจ
-- animationTrack = animator:LoadAnimation(anim)
-- animationTrack:Play()
-- task.delay(3, function()
-- if animationTrack then
-- animationTrack:Stop()
-- end
-- end)
--end
while spill and spill.Size.Magnitude > 0.2 do
spill.Size -= Vector3.new(0.02, 0.02, 0.02)
task.wait(0.01)
end
if spill then
game.ReplicatedStorage.SpillCleaned:FireServer(player)
spill:Destroy()
end
end
end)
end
-- ์ฒ์๋ถํฐ ์๋ ๊ฒ๋ค ์ฐ๊ฒฐ
for _, spill in ipairs(workspace.SpillData.GlobalSpills:GetChildren()) do
SetupSpill(spill)
end
-- ์๋ก ์๊ธฐ๋ ๊ฒ๋ค๋ ์ฐ๊ฒฐ
workspace.SpillData.GlobalSpills.ChildAdded:Connect(function(spill)
SetupSpill(spill)
end)
if animator then
local anim = Instance.new("Animation")
anim.AnimationId = "http://www.roblox.com/Asset?ID=126407570972225" -- โ ์ด๋ ๊ฒ ๊ณ ์ณ์ผ ํจ
animationTrack = animator:LoadAnimation(anim)
animationTrack:Play()
task.delay(3, function()
if animationTrack then
animationTrack:Stop()
end
end)
end
To this:
if animator then
warn('Loaded Animator!')
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://126407570972225" -- โ ์ด๋ ๊ฒ ๊ณ ์ณ์ผ ํจ
animationTrack = animator:LoadAnimation(anim)
animationTrack:Play()
task.delay(3, function()
if animationTrack then
animationTrack:Stop()
end
end)
end
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local eventClean = ReplicatedStorage:WaitForChild("eventclean")
eventClean.OnClientEvent:Connect(function(player, spill)
warn('Event Called!')
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:FindFirstChildOfClass("Humanoid")
warn('Character =', character, "AND humanoid =", humanoid)
local animator = humanoid:FindFirstChildOfClass("Animator")
local tool = script.Parent
if animator then
warn('Loaded Animator!')
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://126407570972225" -- โ ์ด๋ ๊ฒ ๊ณ ์ณ์ผ ํจ
local animationTrack = animator:LoadAnimation(anim)
animationTrack:Play()
task.delay(3, function()
if animationTrack then
animationTrack:Stop()
end
end)
end
end)```
like this?
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local eventClean = ReplicatedStorage:WaitForChild("eventclean")
eventClean.OnClientEvent:Connect(function(player, spill)
warn('Event Called!')
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:FindFirstChildOfClass("Humanoid")
warn('Character =', character, "AND humanoid =", humanoid)
local animator = humanoid:FindFirstChildOfClass("Animator")
local tool = script.Parent
if animator then
warn('Loaded Animator!')
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://126407570972225" -- โ ์ด๋ ๊ฒ ๊ณ ์ณ์ผ ํจ
local animationTrack = animator:LoadAnimation(anim)
animationTrack:Play()
task.delay(3, function()
if animationTrack then
animationTrack:Stop()
end
end)
end
end)
alr, now change this: (IN THE SCRIPT, not the local script)
if animator then
local anim = Instance.new("Animation")
anim.AnimationId = "http://www.roblox.com/Asset?ID=126407570972225" -- โ ์ด๋ ๊ฒ ๊ณ ์ณ์ผ ํจ
animationTrack = animator:LoadAnimation(anim)
animationTrack:Play()
task.delay(3, function()
if animationTrack then
animationTrack:Stop()
end
end)
end
To this:
if animator then
warn('Loaded Animator!')
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://126407570972225" -- โ ์ด๋ ๊ฒ ๊ณ ์ณ์ผ ํจ
animationTrack = animator:LoadAnimation(anim)
animationTrack:Play()
task.delay(3, function()
if animationTrack then
animationTrack:Stop()
end
end)
end
local Players = game:GetService("Players")
local eventClean = ReplicatedStorage:WaitForChild("eventclean")
eventClean.OnClientEvent:Connect(function(player, spill)
warn('Event Called!')
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:FindFirstChildOfClass("Humanoid")
warn('Character =', character, "AND humanoid =", humanoid)
local animator = humanoid:FindFirstChildOfClass("Animator")
local tool = script.Parent
if animator then
local anim = Instance.new("Animation")
anim.AnimationId = "http://www.roblox.com/Asset?ID=126407570972225" -- โ ์ด๋ ๊ฒ ๊ณ ์ณ์ผ ํจ
animationTrack = animator:LoadAnimation(anim)
animationTrack:Play()
task.delay(3, function()
if animationTrack then
animationTrack:Stop()
end
end)
end
end)```
You want me to change it like this?
But I donโt think the request is made from the event or I made a request but it doesnโt seem to be received here.
I see that the log above doesnโt appear.
no no, I meant in the script, not the local script
put this:
if animator then
warn('Loaded Animator!')
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://126407570972225" -- โ ์ด๋ ๊ฒ ๊ณ ์ณ์ผ ํจ
animationTrack = animator:LoadAnimation(anim)
animationTrack:Play()
task.delay(3, function()
if animationTrack then
animationTrack:Stop()
end
end)
end
and remove this:
if animator then
local anim = Instance.new("Animation")
anim.AnimationId = "http://www.roblox.com/Asset?ID=126407570972225" -- โ ์ด๋ ๊ฒ ๊ณ ์ณ์ผ ํจ
animationTrack = animator:LoadAnimation(anim)
animationTrack:Play()
task.delay(3, function()
if animationTrack then
animationTrack:Stop()
end
end)
end
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local eventClean = ReplicatedStorage:WaitForChild("eventclean")
eventClean.OnClientEvent:Connect(function(player, spill)
warn('Event Called!')
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:FindFirstChildOfClass("Humanoid")
warn('Character =', character, "AND humanoid =", humanoid)
local animator = humanoid:FindFirstChildOfClass("Animator")
local tool = script.Parent
if animator then
warn('Loaded Animator!')
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://126407570972225" -- โ ์ด๋ ๊ฒ ๊ณ ์ณ์ผ ํจ
animationTrack = animator:LoadAnimation(anim)
animationTrack:Play()
task.delay(3, function()
if animationTrack then
animationTrack:Stop()
end
end)
end
end)
I think you want to modify this in a script that is not a local script, but it is already that script
There is nothing to modify
I have a script that is 100% the same as that one, but it does not work