Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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))

1 comment

0

Thank you so much

This discussion is preserved as it was. New answers, comments, and votes are closed.