Ad
Log in to vote
0

How can the part clone with a specific Y and X axis?

Asked by 13 days ago
Edited 13 days ago

So when I clone the part out of the serverstorage it clones like layed down and I want it like straight but when I try to change the parts Y and X axis it doesnt work, since my knowlege of scripting is not that big I dont really know what to do

local OnePunch = game.ServerStorage.OnePunch game.ReplicatedStorage.PunchEvent.OnServerEvent:Connect(function(player)

local character = player.Character
local newPunch = OnePunch:Clone()
newPunch.CFrame = character.HumanoidRootPart.CFrame
newPunch.Anchored = true
newPunch = Vector3.new(-168.012,46.197,newPunch.Position.Z) --this is what i need help with

newPunch.Parent = workspace

local touchcon 

touchcon = newPunch.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
        if hit.Parent.Name ~= player.Name then
            hit.Parent:BreakJoints()
            if touchcon ~= nil then touchcon:Disconnect () end
            newPunch:Destroy()
        end
    end
end)

wait(2) 


if touchcon ~= nil then touchcon:Disconnect () end
newPunch:Destroy()

end)

1 answer

Log in to vote
0
Answered by
NykoVania 198 Moderation Voter
13 days ago

Use CFrame.Angles to change the rotation, do this along with your current code on line 3 like this

newPunch.CFrame = character.HumanoidRootPart.CFrame * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0))
0
Thank you so much ashdgg_acfdf 2 — 13d
Ad

Answer this question