In ServerStorage, I have a tool (its a sunscreen bottle) and inside i have a script and an animation inside of it:
Script:
local Tool = script.Parent
local Animation = script:FindFirstChild("Animation")
local player = script:FindFirstAncestorWhichIsA("Player") or game.Players:GetPlayerFromCharacter(script.Parent.Parent)
local character = player.Character or player.CharacterAdded:Wait()
local AnimationTrack = character:WaitForChild("Humanoid"):FindFirstChildOfClass("Animator"):LoadAnimation(Animation)
local mouse = player:GetMouse()
Tool.Activated:Connect(function()
game.ReplicatedStorage.Applying:FireServer(mouse.Hit)
AnimationTrack:Play()
end)
honestly, I don’t see the point in using the reclass plugin just to change a script to a local script when you only have to copy the scripts stuff and paste it.
I made a few changes but it still won’t work:
Script:
local Tool = script.Parent
local Animation = script:FindFirstChild("Animation")
local player = script:FindFirstAncestorWhichIsA("Player") or game.Players:GetPlayerFromCharacter(script.Parent.Parent)
local character = player.Character or player.CharacterAdded:Wait()
local AnimationTrack = character:WaitForChild("Humanoid"):FindFirstChildOfClass("Animator"):LoadAnimation(Animation)
AnimationTrack.Priority = Enum.AnimationPriority.Action
script.Parent.Applying.OnServerEvent:Connect(function()
AnimationTrack:Play()
end)
LocalScript:
local tool = script.Parent
local re = tool:WaitForChild("Applying")
local mouse = game.Players.LocalPlayer:GetMouse()
tool.Activated:Connect(function()
re:FireServer(mouse.Hit)
end)
I had to keep the local player = script:FindFirstAncestorWhichIsA("Player") or game.Players:GetPlayerFromCharacter(script.Parent.Parent) because its used to get the animation track but I did this script.Parent.Applying.OnServerEvent:Connect(function(mouseHit) AnimationTrack:Play() but it still didn’t work
Also, I still have the local script firing the remote event when the mouse is clicked so should I still keep that