Alright am making a ice magic thing, when u pressed Z u will launch the magic and suppose to do a animation, but i don’t know why the animation won’t be played, I tried roblox’s dance animation and it works once only, my own animations (created using Moon Animator) won’y even get loaded once. Here’s the vid:
And here is all my script:
This is the one i placed in StarterPack
wait(1)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UserInputService = game:GetService("UserInputService")
local Remote = ReplicatedStorage:WaitForChild("IceRemote")
local Player = game.Players.LocalPlayer
local Character = Player.Character
local CoolDown = true
local Key = "Z"
local Animation = script.Animation
local Humanoid = Character:WaitForChild("Humanoid")
local LoadedAnimation = Humanoid:LoadAnimation(Animation)
UserInputService.InputBegan:Connect(function(Input, IsTyping)
if IsTyping then return end
local KeyPressed = Input.KeyCode
if KeyPressed == Enum.KeyCode[Key] and CoolDown and Character then
CoolDown = false
LoadedAnimation:Play()
Remote:FireServer()
wait(5)
CoolDown = true
end
end)
and this is the one in ServerScriptService
local ReplicatedStorage = game:WaitForChild("ReplicatedStorage")
local Remote = ReplicatedStorage:WaitForChild("IceRemote")
Remote.OnServerEvent:Connect(function(player)
local Character = player.Character
local RootPart = Character:WaitForChild("HumanoidRootPart")
local folder = workspace:FindFirstChild("DebrisFolder") or Instance.new("Folder",workspace)
folder.Name = "DebrisFolder"
local Position = Instance.new("BodyVelocity",RootPart)
Position.MaxForce = Vector3.new(99999999999999999,99999999999999999,99999999999999999)
Position.P = 300
Position.Velocity = RootPart.CFrame.LookVector * .1
game.Debris:AddItem(Position,0)
local val = -4
local sizez = 2
local sizex = 10
local sideval = .5
local function Ice()
local extra = math.random(-11,11)/10
local Shard = ReplicatedStorage:WaitForChild("IceShard"):Clone()
local side = math.random(-sideval,sideval)
up = Shard.Size.Y/3
local rotate = math.random(0,180)
local MRo = math.random(99,100)
if MRo == 99 then
local SRo = math.random(8,10)/10
URo = MRo + SRo
else
local SRo = math.random(1,3)/10
URo = MRo + SRo
end
Shard.Size = Vector3.new(sizez,sizex,sizez)
Shard.CFrame = RootPart.CFrame * CFrame.new(side,-up,val + extra)
Shard.Parent = folder
Shard.CFrame = Shard.CFrame * CFrame.fromEulerAnglesXYZ(URo,rotate,0.4)
val = val - 2
sizez = sizez + 1
sizex = sizex + 1
sideval = sideval + .5
game.Debris:AddItem(Shard,5)
spawn(function()
wait(.5)
local TweenService = game:GetService("TweenService")
local TweenInform = TweenInfo.new(
.3,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
0,
false,
0
)
local properties = {
CFrame = Shard.CFrame * CFrame.new(0,up * 1.5,0)
}
local Tween = TweenService:Create(Shard,TweenInform,properties)
Tween:Play()
end)
end
for i = 1,35 do
Ice()
Ice()
wait()
end
end)
What should i do to fix this, please help as I wasted like 5-6 hours and stuck at here without any solutions. Any help is appreciated ;-;