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.