I've been trying to make a combat and when I start adding the animations something breaks but I don't know what I get the error "Unable to cast value to Object" this is the script
Enabled = true
script.Parent.OnServerEvent:Connect(function(Player,Action,V1)
local c = Player.Character
if Enabled == false then return end
if Action == "Combat" then
local Track = Instance.new("Animation")
Track.AnimationId = "rbxassetid://5260316569"
local Anim = c.Humanoid:LoadAnimation("Track")
Anim:Play()
wait(0.2)
local Region = Region3.new(V1-Vector3.new(1,1,1),V1+Vector3.new(1,1,1))
local RTable = workspace:FindPartsInRegion3(Region,nil,20)
for i,v in pairs(RTable) do
if v.Parent:FindFirstChild("Humanoid") and v.Parent:FindFirstChild("Deb") == nil and v.Parent ~= c then
local Deb = Instance.new("BoolValue",v.Parent)
Deb.Name = "Deb"
game.Debris:AddItem(Deb,0.2)
v.Parent.Humanoid:TakeDamage(5)
end
end
end
end)

2 comments
what is the whole error?
and what is player action and v1 what are those variables?