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

Tween not working. (there are no syntax errors though) Help?

Asked by 1 year ago

So I have a part that I want to rotate when when I press its proximity prompt using Tweening, but it just doesn't work. Here is my code which is a local script in start character scripts:

local TweenService = game:GetService("TweenService")
local part = workspace.Part
local prompt = part.ProximityPrompt

local goals = {}

prompt.Triggered:Connect(function()
    goals.CFrame = part.CFrame * CFrame.Angles(0,1,0)
    print ("spinning")
    local tween = TweenService:Create(part, TweenInfo.new(1), goals)
    tween:Play()
end)

Before I got an error that it expected CFrame and got nil, but I concluded that was because I put goals instead of part on line 8, which was in fact the case. After changing that to part the errors disappears but the part doesn't rotate at all when I use the proximity prompt. Also if it helps the part is the normal block part but standing up, and I want it to rotate vertically (so its position shouldn't move).

I want the rotation to add on to the last which I thought CFrame.angles would do - so it would lets say rotate 10 degrees then another and another every time you activate the prompt. And do I change the Y argument in CFrame.Angles to math.deg(10)?

Thanks.

0
Update: So I think the CFrame was gettting tweened but like completely wrong? If i have the part standing up its xyz is 0,90,90 and the one i want to change is the y (90) so in the CFrame.Angles() i put 0,math.rad(20),0 but it did not work. However I did put just some random numbers in the Angles() and when the part was knocked over it worked so it just doesn't want to work standing up stampiepoopoo 0 — 1y
0
So is it solved? T3_MasterGamer 2189 — 1y

Answer this question