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

Cfame not capturing the position correctly?

Asked by 3 years ago

I'm trying to make a ability system everything work but when the player is moving and uses the ability the Cfame doesn't place the ability in the right spot anyone know why this is and how to fix it

Oh and by the way I'm having trouble with it doing damage so if anyone knows why that would be great

the script

local event = script.Parent:WaitForChild("Fire")

local FireBall = game.ReplicatedStorage.Abilitys.Medium.Heavy_Slash

local running = false

event.OnServerEvent:Connect(function(Player,MouseCF)
    local Char = Player.Character
    Char.HumanoidRootPart.Anchored = true
    wait(0.5)
    local Fire_Ball = FireBall:Clone()
    Fire_Ball.HumaniodRootPart.Transparency = 1
    Fire_Ball.HumaniodRootPart.CFrame = Char.HumanoidRootPart.CFrame
    Fire_Ball.Parent = game.Workspace
    Fire_Ball.HumaniodRootPart.Anchored = true

    local con = Fire_Ball.Slash.Touched:Connect(function(hit)
        if hit.Parent:FindFirstChild("Humanoid") and hit.Parent.Name == Player.Name and running == false then print(1)
            running = true
            hit.Parent.Humanoid:TakeDamage(25)
            wait(1)
            running = false
        end
    end)

    wait(0.48)
    Fire_Ball.Wind.Transparency = 0.95
    Fire_Ball.Slash.Transparency = 0.2
    wait(0.1)
    Fire_Ball.Wind.Transparency = 1
    Fire_Ball.Slash.Transparency = 0.4
    wait(0.1)
    Fire_Ball.Slash.Transparency = 0.6
    wait(0.1)
    Fire_Ball.Slash.Transparency = 0.8
    wait(0.1)
    Fire_Ball.Slash.Transparency = 1
    Char.HumanoidRootPart.Anchored = false
    con:Disconnect()
    Fire_Ball:Destroy()
end)

Answer this question