Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Unable to cast value to object trying to make combat system?

Asked by
Surrma 0
3 years ago
Edited by Amiaa16 3 years ago

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)
0
what is the whole error? botw_legend 502 — 3y
0
and what is player action and v1 what are those variables? botw_legend 502 — 3y

Answer this question