So, I have found a workaround for this I think.
I have created a brand new script, just tested it and its working fine. I just cant seem to figure out the mouse problem.
local Event = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")
local Debris = game:GetService("Debris")
local animations = script:WaitForChild("Animations")
local Fireball
local Weld
local hold
local throw
local strstring = "start"
local endstring = "end"
Event.OnServerEvent:Connect(function(player, str)
local chr = player.Character or player.CharacterAdded:Wait()
local hum = chr:WaitForChild("Humanoid")
local rootpart = chr:WaitForChild("HumanoidRootPart")
local holdinghand = chr:WaitForChild("Left Arm")
hold = hum.Animator:LoadAnimation(animations:WaitForChild("FireballHold"))
throw = hum.Animator:LoadAnimation(animations:WaitForChild("FireballThrow"))
if str == strstring and not hold.IsPlaying then
print("play")
hold:Play(0)
Fireball = game:GetService("ServerStorage"):WaitForChild("Fireball"):Clone()
Fireball.Parent = workspace
Fireball.CFrame = holdinghand.CFrame * CFrame.new(0,-1,1)
Fireball.Parent = chr
Weld = Instance.new("WeldConstraint", Fireball)
Weld.Part0 = Fireball
Weld.Part1 = holdinghand
end
end)
Event.OnServerEvent:Connect(function(player, str, mouse)
local chr = player.Character or player.CharacterAdded:Wait()
local hum = chr:WaitForChild("Humanoid")
local rootpart = chr:WaitForChild("HumanoidRootPart")
local holdinghand = chr:WaitForChild("Left Arm")
if str == endstring and hold.IsPlaying then
print("stop")
hold:Stop()
throw:Play()
throw:AdjustSpeed(2)
Weld:Destroy()
local BV = Instance.new("BodyVelocity", Fireball)
BV.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
BV.P = 10000000
BV.Velocity = mouse.Hit.LookVector * 100
Debris:AddItem(Fireball,5)
Fireball.Touched:Connect(function(Touched)
if Touched:IsDescendantOf(chr) then return end
local CF = CFrame.new(Touched.Parent.PrimaryPart.Position + Vector3.new(0,2,0),rootpart.Position)
local y = Instance.new("BodyVelocity")
y.maxForce = Vector3.new(-10000, 0, 0)
y.Parent = Touched
y.velocity = CF.LookVector * 50
game:GetService("Debris"):AddItem(y,.5)
--for _,v in pairs(Fireball:GetDescendants()) do
-- if v:IsA("PointLight") or v:IsA("Trail") then
-- v.Enabled = false
-- elseif v:IsA("ParticleEmitter") then
-- v:Destroy()
-- end
--end
wait(1)
Fireball:Destroy()
throw:Stop()
if Touched.Parent:FindFirstChild("Humanoid") then
Touched.Parent:FindFirstChild("Humanoid"):TakeDamage(30)
--wait(0.5)
-- Touched.Parent:WaitForChild("Ragdoll").Value = true
--wait(4)
--Touched.Parent:WaitForChild("Ragdoll").Value = false
end
end)
end
end)
The issue in this is super weird. I do blame Roblox’s programming language for this problem. Anyways the problem, it won’t detect the string and if the holding animation is playing at the same time? I have no clue, but thats my take on it.
Down below is a client script that I used to test the ServerScript.
local p = game:GetService("Players").LocalPlayer
local mouse = p:GetMouse()
local r = game:GetService("ReplicatedStorage").RemoteEvent
game:GetService("UserInputService").InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.F then
r:FireServer("start")
end
end)
game:GetService("UserInputService").InputEnded:Connect(function(input)
if input.KeyCode == Enum.KeyCode.F then
r:FireServer("end", mouse)
end
end)
fixed this line:
if str == endstring and hold.IsPlaying then
print("stop")
hold:Stop()
throw:Play()
throw:AdjustSpeed(2)
original line:
if str == endstring and hold.IsPlaying then
print("stop")
hold:Stop(0)