So I Wanted To Make A Sword And It Face Upward Yet. So When I Try Set The Lookvector Or Set The Look. It Set It Self Not In The Upward(Blade) Direction. I’ve Try Scripted But Not Work. Is Theres Any Ways To Do That?
Sword
I Don’t Know If There Is A Ways…
Here My Script. You Can Check If There Any Issue, And This Is Just A Small Line:
ServerSide Script
local sword = game.ReplicatedStorage.Demind:FindFirstChild("Sword") and game.ReplicatedStorage.Demind.Sword:Clone()
if sword then
sword.Parent = Workspace
sword.Position = root.Position - Vector3.new(math.random(-64,64),18,math.random(-64,64))
sword.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and Players:GetPlayerFromCharacter(hit.Parent) then
hit.Parent.Humanoid:TakeDamage(12)
end
end)
local tweenFly = TweenService:Create(sword, TweenInfo.new(0.8), {Position = sword.Position + Vector3.new(0, 24, 0)})
tweenFly:Play()
tweenFly.Completed:Wait()
sword.Script.Enabled = true
for _ = 1, 480 do
task.wait()
if not sword then
return
end
-- build axes so Y points at target
local yAxis = (getNearestPlayerPosition(root.Position) - sword.Position).Unit
local arb = math.abs(yAxis.Y) > 0.99 and Vector3.new(1, 0, 0) or Vector3.new(0, 1, 0)
local xAxis = arb:Cross(yAxis).Unit
local zAxis = yAxis:Cross(xAxis)
sword.CFrame = CFrame.fromMatrix(sword.Position, xAxis, yAxis, -zAxis)
end
-- Once rotation done, fling sword to the player pos
local dir = (getNearestPlayerPosition(root.Position) or sword.Position).Unit * 640
local params = RaycastParams.new()
params.FilterDescendantsInstances = { sword, root.Parent }
params.FilterType = Enum.RaycastFilterType.Blacklist
params.IgnoreWater = true
local result = workspace:Raycast(sword.Position, dir, params)
local destination = result and result.Position or (sword.Position + dir)
local flingTween = TweenService:Create(
sword,
TweenInfo.new(0.4, Enum.EasingStyle.Quad, Enum.EasingDirection.In),
{ Position = destination }
)
flingTween:Play()
flingTween.Completed:Connect(function()
if sword then
sword:Destroy()
end
end)
end
I Don’t Know. You Can Help.