Hello. This doesn’t seem to work. The output doesnt print any errors so it might be in my setting up the weld. Here it is, did i do it correctly?
And the arm is unanchored.
Hello. This doesn’t seem to work. The output doesnt print any errors so it might be in my setting up the weld. Here it is, did i do it correctly?
And the arm is unanchored.
Ok so I have 2 questions.
What actually does happen? For example, does it pivot the wrong way, does it do nothing at all?
And then also, did you change the first tweens vector3 value to the rotation that you need?
Oh i am stupid. I didnt see that it wasnt set
Do i set it to the arm.Orientation?
You can’t set the Orientation property; you need to change the CFrame.
Also, I only just skimmed through the topic so far so sorry if this was said before, but instead of using a separate pole/part as your joint, if the barrier is just one part or model, you can use PivotOffsets to help achieve rotation around one point.
Set the PivotOffset of the part/model to the desired joint through the PivotOffset property; scripting will be much easier. (Do the same for the invisible part!)
(Sorry if this only answers part of your question; I’ll add a bit more to it.)
That may work, but I think the path we are working on might work too. Anyways, for that vector 3 value, pivot the joint to the orientation it would move to to be opened. Then, copy the orientation value and paste it in place of the string as
Vector3.new(pasted value)
Make sure you put the joint back to the closed position afterwards.
Idk if this is correct but I tried this and it didn’t do anything.
local uptween = tweenservice:Create(joint, TweenInfo.new(1.5, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, false, 0),{["Orientation"]=Vector3.new(65, 5, 0)})
Also, I do have to go for a little while now, so if you still need help after this, you may have to wait about 20-30 mins or have this dude help you!
Hmmmmm. I’ll look into it further a little later, but now I have to go. Sorry!
That is okay.
Thanks for the help
First off, a couple of issues with your dictionary of properties:
["Property"]
. I’m not 100% sure if this is valid but I know for a fact that it works without it. Just do {Property = value}
.Orientation
property is Studio only, and it cannot be set. To achieve the desired effect, instead tween the CFrame
property. You already have a part (ArmUp) with the exact CFrame you want, luckily enough!Tween:Play()
which must be included for it to do anything; e.g., on the next line, uptween:Play()
.Instead, tween {CFrame = ArmUp.CFrame}
.
I just went through the effort and the following script works!
local arm = script.Parent -- The arm to move
local armUpGoal = script.Parent.Parent.ArmUp.CFrame -- The CFrame of your "ArmUp" goal
local armDownGoal = script.Parent.Parent.ArmDown.CFrame -- The CFrame of your "ArmDown" goal
local armUp = false -- used to check the arm's state
local prompt = arm.Interact -- The proximity prompt
local tweenService = game:GetService("TweenService") -- TweenService
local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut) -- Desired TweenInfo
prompt.Triggered:Connect(function(plr)
-- Include additional logic here if necessary!
if not armUp then
tweenService:Create(arm, tweenInfo, {CFrame = armUpGoal}):Play() -- you can also create and :Play() on the same line. Less versatile but easier.
armUp = true -- remember to set this!
else
tweenService:Create(arm, tweenInfo, {CFrame = armDownGoal}):Play()
armUp = false
end
end)
The explorer view:
And a clip of it working: (embed didn’t work properly…)
(This uses PivotOffsets. Make sure to set yours!)
Very nice!
Hope this works. And if it doesn’t, then I can help with troubleshooting further.
Hello. When i tested it the first time the arm was set to script.parent which was the part that holds the prompt so it was moving the prompt around lol but when i corrected this issue and set the arm to the actual arm it didn’t move at all.
I’ve tested with anchored and unanchored arm and neither worked
And I did remember to set the PivotOffset
I figured out its just cuz im silly and i forgot to set the proximity prompt. But its still the same issue. It moves unlike a barrier would irl. Here is a video.
robloxapp-20250104-0333525.wmv (614.3 KB)
Alright, I’ve got it. This script instead uses a pivot part which has a more accurate translation.
Sadly, this causes a more robotic, mechanical motion; there are ways around that but I can’t really think of them right now. On the bright side, that’s also kind of realistic, I suppose. Hopefully it works for you either way.
local arm = script.Parent -- The arm to move
local pivot = script.Parent.Parent.Pivot
local armUpGoal = script.Parent.Parent.ArmUp.CFrame -- The CFrame of your "ArmUp" goal
local armDownGoal = script.Parent.Parent.ArmDown.CFrame -- The CFrame of your "ArmDown" goal
local armUp = false -- used to check the arm's state
local prompt = arm.Interact -- The proximity prompt
local moving = false -- used to check if the prompt is valid.
prompt.Triggered:Connect(function(plr)
-- Include additional logic here if necessary!
if moving then return end -- so we don't cause strange behavior.
moving = true
if not armUp then
repeat
task.wait()
pivot.CFrame = pivot.CFrame * CFrame.Angles(0,0,math.rad(-1)) -- for me, it's negative; might not be for you.
arm:PivotTo(pivot.CFrame) -- importantly, use PivotTo to achieve the realistic motion!
until pivot.Orientation.Z <= -45 -- set to angle of choice, or ArmUp.Orientation.Z!
armUp = true -- remember to set this!
moving = false
else
repeat
task.wait()
pivot.CFrame = pivot.CFrame * CFrame.Angles(0,0,math.rad(1))
arm:PivotTo(pivot.CFrame)
until pivot.Orientation.Z >= 0
armUp = false
moving = false
end
end)
And the explorer view:
And lastly a clip of it working: (once again the embedding might not work)
This finally works! Thank you so much for the help
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.