when i activate my tail it supposed to play the activate animation i made but instead it looks like this.
i also have the animations played by a local script and the model spawned by a server script.
Why does this happen?
-Side Note: The animations are completly loaded by a local script that loads them
local UserInputService = game:GetService("UserInputService")
local QuickEvent = game.ReplicatedStorage.Events.QuickEvent
local Activated = false
local debounce = false
local coolDown = 1
local Idle = nil
local player = game:GetService("Players").LocalPlayer
local Character = player.Character or player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
UserInputService.InputBegan:Connect(function(Input, isTyping)
if not isTyping and Input.KeyCode == Enum.KeyCode.One then
if debounce == false and Activated == false then
Activated = true
QuickEvent:FireServer("ActivateKen1", Character)
local Ken1 = Character:WaitForChild("Ken1")
local AnimationController = Ken1:FindFirstChild("AnimationController")
local ActivateAnim = AnimationController:LoadAnimation(script.Animations.Activate)
ActivateAnim:Play()
ActivateAnim.Stopped:Connect(function()
Idle = AnimationController:LoadAnimation(script.Animations.Idle)
Idle:Play()
debounce = true
end)
end
if Activated == true and debounce == true then
Activated = false
QuickEvent:FireServer("DiactivateKen1", Character)
local Ken1 = Character:FindFirstChild("Ken1")
if Ken1 then
local AnimationController = Ken1:FindFirstChild("AnimationController")
local DiactivateAnim = AnimationController:LoadAnimation(script.Animations.Diactivate)
DiactivateAnim:Play()
DiactivateAnim.Stopped:Connect(function()
delay(coolDown, function()
debounce = false
end)
end)
end
end
end
end)
Server Script:
local QuickEvent = game.ReplicatedStorage.Events.QuickEvent
local TweenService = game:GetService("TweenService")
QuickEvent.OnServerEvent:Connect(function(player, Event, Character)
if Event == "ActivateKen1" then
local Ken1 = game.ReplicatedStorage.Kagunes.Ken.Ken1.Ken1:Clone()
local mWeld = Instance.new("ManualWeld", Ken1.UpperTorsoPoint)
mWeld.Part0 = Ken1.UpperTorsoPoint
mWeld.Part1 = Character.UpperTorso
Ken1.Parent = Character
for i, v in pairs(Ken1:GetChildren()) do
if v:IsA("BasePart") and v.Name ~= "UpperTorsoPoint" then
v.Transparency = 1
local Apear = TweenService:Create(v, TweenInfo.new(0.2, Enum.EasingStyle.Sine), {Transparency = 0})
Apear:Play()
end
end
elseif Event == "DiactivateKen1" then
local Ken1 = Character:FindFirstChild("Ken1")
if Ken1 then
for i, v in pairs(Ken1:GetChildren()) do
if v:IsA("BasePart") and v.Name ~= "UpperTorsoPoint" then
local Apear = TweenService:Create(v, TweenInfo.new(0.4, Enum.EasingStyle.Sine), {Transparency = 1})
Apear:Play()
end
end
delay(1, function()
Ken1:Destroy()
end)
end
end
end)
I cant see a problem here. Well, maybe you could use a remote function to create the Ken1, instead of a remote event to create it and then wait for it, but that’s it.
What should happen? The tail (if it is a tail) doesn’t activate as it should? Or is it that little flicker at the beginning of the activation?
In this case, try to use a remote function to create the Ken1. Here’s the documentation.
I think that flicker is because of the lag between the server and the client, so you can’t really do much about it, but hopefully this will make it smaller.
Or to (almost) completely remove the lag, you could create the Ken1 on the client instead. And if you need other players to see it too, make it on the server too, and then make it invisible to the original client.
This is a better solution, but it also takes more time.