#cant change the parts position in the tool

1 messages · Page 1 of 1 (latest)

static solstice
#

i made a sword with a blade that grows every time i hit a player, but when it grows i need the position to go higher to fit it on the handle, but when i use CFrame, it doesn't move at all, when i use Position, it moves but then it looks like what i put in the image.
how do i fix this?

the code im using

local Katana = script.Parent
local blade = Katana.blade

local swingAnimation1 = Katana.swinganimation

activated = false
touchcooldown = false
activatedcooldowntime = 0.25
local touchedplayers = {}
blade.Touched:Connect(function(hit)
    if activated == true and hit.Parent:FindFirstChild("Humanoid") then
        local myplayer = game:GetService("Players"):GetPlayerFromCharacter(Katana.Parent)
        local myhumanoid = myplayer:FindFirstChild("Humanoid")
        local mycharacter = myplayer.Character or myplayer.CharacterAdded:Wait()
        local myHumanoidRootPart = mycharacter:FindFirstChild("HumanoidRootPart")
        local humanoid = hit.Parent:FindFirstChild("Humanoid")
        local character = humanoid.Parent
        local player = game:GetService("Players"):GetPlayerFromCharacter(character)
        if humanoid.Parent ~= Katana.Parent then
            if player and touchedplayers[player] then
                -- (uneeded code)
            elseif touchcooldown == false then
                local damage = math.random(1,100)
                print(damage)
                touchcooldown = true
                humanoid.Health -= damage
                blade.Size += Vector3.new(0, 0.5, 0)
                                --blade.CFrame += CFrame.new(0, 0.25, 0)
                blade.Position += Vector3.new(0, 0.25, 0)
                task.wait(activatedcooldowntime)
                touchcooldown = false
            end
        end
    end
end
end)```
stiff path
#

simplest way for you is probably blade.position += blade.cframe.upvector * distance

static solstice