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

Ball keeps going to the center of the map, even though I want It to just move up (?)

Asked by 2 years ago

The title says It all

Script:

local Tool = script.Parent
local Debounce = false
local TweenService = game:GetService("TweenService")

Tool.Activated:Connect(function()
    if not Debounce then
        Debounce = true
        local BlizzardBall = Instance.new("Part",game.Workspace)
        BlizzardBall.Position = Tool.Parent.Torso.Position
        BlizzardBall.Anchored = true
        BlizzardBall.CanCollide = false
        BlizzardBall.Transparency = 0.5
        BlizzardBall.CastShadow = false
        BlizzardBall.Material = Enum.Material.Ice
        BlizzardBall.Size = Vector3.new(1,1,1)
        BlizzardBall.Shape = Enum.PartType.Ball
        local TweenStuff = {
            Size = Vector3.new(10,10,10),
            CFrame = CFrame.new(0,10,0)
        }
        local Tweeninfo = TweenInfo.new(
            1,
            Enum.EasingStyle.Bounce,
            Enum.EasingDirection.Out,
            0,
            false,
            0
        )
        local Tween = TweenService:Create(BlizzardBall,Tweeninfo,TweenStuff)
        Tween:Play()
        wait(2)
        local TweenExplosionStuff = {
            Size = Vector3.new(150,150,150)
        }
        local TweeninfoExplosion = TweenInfo.new(
            1,
            Enum.EasingStyle.Bounce,
            Enum.EasingDirection.Out,
            0,
            false,
            0
        )
        local TweenExplode = TweenService:Create(BlizzardBall,TweeninfoExplosion,TweenExplosionStuff)
        TweenExplode:Play()
        BlizzardBall.Touched:Connect(function(hit)
            local Humanoid = hit.Parent:WaitForChild("Humanoid")
            if Humanoid then
                Tool.Parent.Humanoid.Health += 50
                Humanoid:TakeDamage(50)
                Humanoid.WalkSpeed = 10
            end
        end)
        wait(5)
        Debounce = false
    end
end)

2 answers

Log in to vote
0
Answered by 2 years ago

Can You push the ball at all? If you can't it means it is weld or anchored to a part in the middle of the map. Simply unanchor it or unweld it. If that's not the case see if your coordinates are right. Play with the numbers to see if it changes where it goes.

Ad
Log in to vote
0
Answered by
xXMadonXx 190
2 years ago

In your script there is:

local TweenStuff = {
    Size = Vector3.new(10,10,10),
    CFrame = CFrame.new(0,10,0)
}

If you create a new CFrame as final position and give it coordinates, it is using those coordinates based on the Workspace and not your TweenPart.

If you just need Position movement relative to workspace and not Rotation or movement relative to the part, I recommend using the Position property and not CFrames.

Also you still need to set the TweenPart as starting point. To do that, just add it.

Example:

local TweenStuff = {
    Size = Vector3.new(10,10,10),
    Position = part.Position + Vector3.new(0,10,0)
    --We are adding to the coordinates of the TweenPart and therefore using it as starting point/offset
}

Answer this question