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

I need the "Fireball" to come out of my character example: Torso?

Asked by 3 years ago

I'm trying to make a fireball, so far so good, I press the clone button and it appears in the workspace, but I want it to come out directly from my character, can you help me?

This is my script

local tweenService = game:GetService("TweenService")

local itraminstorage = game.ReplicatedStorage.FireBall

local UserInputService = game:GetService("UserInputService")

UserInputService.InputBegan:Connect(function(Input)
    if Input.KeyCode == Enum.KeyCode.Q then
        print("Pressed")

        local parte = itraminstorage:Clone()
        parte.Parent = workspace

        local function onTouch(Touch)

            local character = Touch.Parent

            local humanoid = character:FindFirstChildWhichIsA("Humanoid")

            if humanoid then

                local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Cubic, Enum.EasingDirection.Out, 0 , false)
                local tweenGoals = { Size = Vector3.new(20,20,20) }
                local tween = tweenService:Create(parte, tweenInfo, tweenGoals)
                parte.Transparency = 0.3
                parte.CanCollide = false
                parte.Anchored = true
                tween:Play()
                humanoid.Health = 0
                wait(1)
                parte:Destroy()

            end

        end 

        parte.Touched:Connect(onTouch)


    end
end)

As I am still learning, maybe this code is exaggerated for a simple fireball

0
Why not set the part's position by part.Position = Character.Torso.Position? Right before line 12, where you set its parent to workspace. radiant_Light203 1166 — 3y

Answer this question