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

Aoe bubble not working as Intended (?)

Asked by 2 years ago

Hello!

I made a tool that which activated, activates this script which makes a massive AOE bubble that gives you and the enemy a forcefield, the problem Is that the other Forcefield Is not given to the enemy's position, Its always going center to baseplate

Script:

local Troll = script.Parent
local TweenSerivce = game:GetService("TweenService")

Troll.Befriend.OnServerEvent:Connect(function()
    local RandomVoiceLine = math.random(1,2)

    if RandomVoiceLine == 1 then
        Troll.Voicelines["Will you be my friend?"]:Play()
        local AoE = Instance.new("Part",game.Workspace)
        AoE.Position = Troll.Torso.Position
        AoE.CanCollide = false
        AoE.Transparency = 1
        AoE.Anchored = true
        AoE.Size = Vector3.new(15,15,15)
        AoE.Shape = Enum.PartType.Ball
        AoE.Touched:Connect(function(hit)
            local Humanoid = hit.Parent:WaitForChild("Humanoid")
            if Humanoid then
                local ForceField1 = Instance.new("ForceField",hit.Parent)
                local ForceField2 = Instance.new("ForceField",Troll.Parent)
            end
        end)
    end
    if RandomVoiceLine == 2 then
        Troll.Voicelines["I love spending time with you"]:Play()
        local AoE = Instance.new("Part",game.Workspace)
        AoE.Position = Troll.Torso.Position
        AoE.CanCollide = false
        AoE.Transparency = 1
        AoE.Anchored = true
        AoE.Size = Vector3.new(15,15,15)
        AoE.Shape = Enum.PartType.Ball
        AoE.Touched:Connect(function(hit)
            local Humanoid = hit.Parent:WaitForChild("Humanoid")
            if Humanoid then
                local ForceField1 = Instance.new("ForceField",hit.Parent)
                local ForceField2 = Instance.new("ForceField",Troll.Parent)
            end
        end)
    end
end)

Answer this question