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

How to affect Orientation?

Asked by 5 years ago
Edited 5 years ago

This script I'm making creates spikes that rise from the ground, but I can't seem to figure out how to properly implement Orientation, the spike i'm using is naturally on its side, so I need to orient it properly so the spike will point up before it emerges out of the ground.

When I tried orientating it in the script it worked... when movement wasn't involved, but I also need the spikes to rise out of the ground, and for some reason they wont orient like I want them to. My theory is that the orientation resets whenever I move the part.

--This is a small block of the code, but its all that you need to work with
 for i = 1,30 do
    earthspike = game:GetService("ServerStorage").Spike:Clone()
    earthspike.Anchored = true
    earthspike.CanCollide = true
    earthspike.Parent = workspace
    earthspike.CFrame = ar.CFrame * CFrame.new(-5,math.random(-40,40),math.random(-40,40))
    game.Debris:AddItem(earthspike,5)
    local tween = game:GetService("TweenService")
    local tweenInfo2 = TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0)
    local tweenProperty2 = {CFrame = earthspike.CFrame + Vector3.new(0,5,0)}
    local tweenRun2 = tween:Create(earthspike,tweenInfo2,tweenProperty2)
    tweenRun2:Play()
end

Answer this question