So I am making a script where it changes the animation pose of a player. I am finding that it will be a bit weird at times. It shows the right animation locally but not globally, but then for some players, it will show it on you working but won’t show it working for you. If that makes sense.
I have tried all I know and I cannot quite figure out how to fix the issue. Here is the scripting, this is in a local script:
– Green Tree Casket Controls
— Created 3/2/2022
---- By: Sterling_ODeaghaidh
--------Variables--------------
UI = script.Parent
Casket = UI.Casket.Value
Curan = nil
------Begin Code-------------------
UI.Frame.High.MouseButton1Click:Connect(function()
Casket.Folder.Prompt:FireServer(“High”)
end)
UI.Frame.Mid.MouseButton1Click:Connect(function()
Casket.Folder.Prompt:FireServer(“Mid”)
end)
UI.Frame.Hearse.MouseButton1Click:Connect(function()
Casket.Folder.Prompt:FireServer(“Hearse”)
end)
UI.Frame.Low.MouseButton1Click:Connect(function()
Casket.Folder.Prompt:FireServer(“Ground”)
end)
Casket.Folder.Prompt.OnClientEvent:Connect(function(M,I,I2)
local Plr = game.Players.LocalPlayer
local human = Plr.Character:FindFirstChild(“Humanoid”)
if M == “Attach” then
for i, c in pairs(Casket.Folder:GetChildren()) do
if c:IsA(“StringValue”) and c.Name == Plr.Name then
if I.Name == “Rear” then
local anim = human.Animator:LoadAnimation(Casket.Folder.PallbearerScript.Rear)
Curan = anim
if human ~= nil then
anim:Play()
anim:AdjustSpeed(0.5)
end
end
if I.Name == “Front” then
local anim1 = human.Animator:LoadAnimation(Casket.Folder.PallbearerScript.Front)
Curan = anim1
if human ~= nil then
anim1:Play()
anim1:AdjustSpeed(0.5)
end
end
if I.Name == "Left" then
local anim2 = human.Animator:LoadAnimation(Casket.Folder.PallbearerScript.Right)
Curan = anim2
if human ~= nil then
anim2:Play()
anim2:AdjustSpeed(0.5)
end
end
if I.Name == "Right" then
local anim3 = human.Animator:LoadAnimation(Casket.Folder.PallbearerScript.Left)
Curan = anim3
if human ~= nil then
anim3:Play()
anim3:AdjustSpeed(0.5)
end
end
Casket.Folder.Prompt:FireServer("Attach",I,I2)
end
end
end
----
if M == "AnimReset" then
for index, child1 in pairs(human:GetChildren()) do
if child1:IsA("Animator") then
child1:Destroy()
wait(.1)
local T = Instance.new("Animator")
T.Name = "Animator"
T.Parent = human
end
end
Plr.PlayerScripts.PallLocal.Enabled = true
UI:Destroy()
end
----
if M == "AnimChange" then
for i, c in pairs(Casket.Folder:GetChildren()) do
if c:IsA("StringValue") and c.Name == Plr.Name then
if c.Value == "Rear" then
local anim = human.Animator:LoadAnimation(Casket.Folder.PallbearerScript.Rear)
Curan:Stop()
Curan = anim
if human ~= nil then
anim:Play()
anim:AdjustSpeed(0.5)
end
end
if c.Value == "Front" then
local anim1 = human.Animator:LoadAnimation(Casket.Folder.PallbearerScript.Front)
Curan:Stop()
Curan = anim1
if human ~= nil then
anim1:Play()
anim1:AdjustSpeed(0.5)
end
end
if c.Value == "Left" then
local anim2 = human.Animator:LoadAnimation(Casket.Folder.PallbearerScript.Right)
Curan:Stop()
Curan = anim2
if human ~= nil then
anim2:Play()
anim2:AdjustSpeed(0.5)
end
end
if c.Value == "Right" then
local anim3 = human.Animator:LoadAnimation(Casket.Folder.PallbearerScript.Left)
Curan:Stop()
Curan = anim3
if human ~= nil then
anim3:Play()
anim3:AdjustSpeed(0.5)
end
end
end
end
end
end)
while true do wait()
if Casket.Folder.Lead1.Value == game.Players.LocalPlayer then
UI.Frame.Visible = true
script.Parent.LocalControlScript.Enabled = true
else
UI.Frame.Visible = false
script.Parent.LocalControlScript.Enabled = false
end
end