Please note that I’ve just started working on it like a day ago so still working a few things out, therefor apologies for any undefined variables, or bad code etiquette.
local BREAK_COMBAT = false
local players = game:GetService("Players")
local player = game.Players.LocalPlayer
workspace:WaitForChild("FightSys")
local char = player.Character
if not char or not char.Parent then
char = player.CharacterAdded:Wait()
end
local TS = game:GetService("TweenService")
local humanoid = char:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
local UIS = game:GetService("UserInputService")
--//Creating Hitbox
---
local AT = {
["Fighting"] = false,
["Blocking"] = false,
["FightingStance"] = "rbxassetid://7423112210",
["BlockStance"] = "rbxassetid://7423840292",
["Animations"] = {
--
["Ljab"] = {
["ID"] = "rbxassetid://7423204629",
["Damage"] = 2,
["C"] = false,
["N"] = "Ljab",
["CT"] = 1,
["Type"] = "Punch_Fist",
["AOE"] = {
["LeftHand"] = true,
},
},
["Rjab"] = {
["ID"] = "rbxassetid://7423405060",
["C"] = false,
["CT"] = 1,
["Damage2"] = 1,
["Type"] = "Punch_Fist",
["AOE"] = {
["RightHand"] = true,
}
}
},
}
--//Instancing Animations
local FightingStance = Instance.new("Animation")
local BlockStance = Instance.new("Animation")
-----------------------------------------------
--Setting Animations
FightingStance.AnimationId = AT["FightingStance"]
BlockStance.AnimationId = AT["BlockStance"]
--Loading Animations
local fightstanceload = humanoid:LoadAnimation(FightingStance)
local blockstanceload = humanoid:LoadAnimation(BlockStance) --[[Setting]]
----------------------------------------------------------------
UIS.InputEnded:Connect(function(k, p)
if p then return end
if k.KeyCode == Enum.KeyCode.F then
print("Run")
AT["Blocking"] = false
blockstanceload:Stop()
workspace.FightSys["</>"].Script.RemoteEvent:FireServer("InsertBlockvalue", AT["Blocking"])
if AT["Fighting"] == true then
blockstanceload:Stop()
fightstanceload:Play()
end
end
end)
UIS.InputBegan:Connect(function(k, p)
if p then return end
if k.KeyCode == Enum.KeyCode.F then
--block
AT["Blocking"] = true
workspace.FightSys["</>"].Script.RemoteEvent:FireServer("InsertBlockvalue", AT["Blocking"])
fightstanceload:Stop()
blockstanceload:Play()
end
if k.KeyCode == Enum.KeyCode.B then
--Fight Stance Toggle
if AT["Fighting"] == false then
fightstanceload:Play()
blockstanceload:Stop()
AT["Blocking"] = false
AT["Fighting"] = true
print("Ran")
elseif AT["Fighting"] == true then
AT["Blocking"] = false
blockstanceload:Stop()
fightstanceload:Stop()
AT["Fighting"] = false
end
end
end)
--fight portion
local fs = workspace.FightSys
local mouse = game.Players.LocalPlayer:GetMouse()
local function CoolDownHandler(v1,v2,v3)
wait(v1["CT"])
v1["C"] = false
print("Clear Cooldown")
end
mouse.Button1Down:Connect(function()
if AT["Blocking"] == true then return end
if AT["Fighting"] == true then
local anim = Instance.new("Animation")
anim.AnimationId = AT["Animations"]["Ljab"]["ID"]
local loadanim = humanoid:LoadAnimation(anim)
loadanim:Play()
for i, v in pairs(AT["Animations"]["Ljab"]["AOE"]) do
local ee
ee= game.Players.LocalPlayer.Character[i].Touched:Connect(function(t)
spawn(function(FixDisconnect)
wait(.45)
ee:Disconnect()
end)
if t.Parent:FindFirstChild("Humanoid") then
if ee then
ee:Disconnect()
end
workspace.FightSys["</>"].Script.RemoteEvent:FireServer(AT["Animations"]["Ljab"]["Damage"], t.Parent.Name, t.Name)
end
end)
end
local window = true
local catch = false
local e
spawn(function()
--Close window
for i = 1,2 do
wait(.25)
if i == 2 then
window = false
if e then
e:Disconnect()
end
end
end
end)
e = UIS.InputBegan:Connect(function(k, p)
if p then
else
if k.KeyCode == Enum.KeyCode.R then
if window then
e:Disconnect()
catch = true
else
e:Disconnect()
end
end
end
end)
loadanim.Stopped:Connect(function()
if catch then
e:Disconnect()
local anim2 = Instance.new("Animation")
anim2.AnimationId = AT["Animations"]["Rjab"]["ID"]
local load2 = humanoid:LoadAnimation(anim2)
loadanim:Stop()
load2:Play()
for i, v in pairs(AT["Animations"]["Rjab"]["AOE"]) do
local ee
ee= game.Players.LocalPlayer.Character[i].Touched:Connect(function(t)
spawn(function(FixDisconnect)
wait(.45)
ee:Disconnect()
end)
if t.Parent:FindFirstChild("Humanoid") then
if ee then
ee:Disconnect()
end
workspace.FightSys["</>"].Script.RemoteEvent:FireServer(AT["Animations"]["Rjab"]["Damage"], t.Parent.Name, t.Name)
end
end)
end
end
end)
end
end)
No, there is no errors. I sent the script if you wanna read through it but if its working in studio i cant think of any reason for this to not be working…
Where, and I would assume this would raise an error? Why would it only not be available in the game. I will try it but I wanna know the reasoning behind this explanation.
regardless @lanjtlike, I doubt this is a problem because 1. The script would not execute further if that were the case, and in the game the script is executing its just not working for half of it it only runs one part and half the stuff isn’t loading. however it works in studios. there’s no “infinite yield possible” errors in console.
The problem is probably in this remote event. If there is any code that needs to be on the client in there, it would work in studio because the server is also the client but might not work in game.
From the looks of this, it seems to me that one possible reason is that those animations were made and exported on someone’s else’s account. For some reason, animations owned by someone else will play in studio but they won’t play in the actual game.
Were you the creator of those animations or did a friend animate those for you?