Hello. I’ve already tried this and what happened is it also moved on the X axis. I want it to just go up and down but it like moved back and fourth on the X axis also. Is there a workaround?
You would call the variable of the barrier (the not invisible one).CFrame then get another variable of the invisible part’s.CFrame, set the TweenInfo parameters you want, then :Play() it after the ProximityPrompt has been triggered
Not sure what “Arm”, “ArmDown”, “ArmUp”, etc are, but if they’re different parts of the barrier, I suggest first welding them all together onto a different ANCHORED part (i called it ROOTPART in the script).
This script would move the arm up
local TweenService = game:GetService('TweenService')
local RootPart = EntranceGate.ROOTPART -- the part where all the other parts are welded to
---
TweenService:Create(RootPart, TweenInfo.new(3), {CFrame = ArmUp.CFrame}):Play() -- i assume ArmUp is the position where the arm will be when its up?
local prox = script.Parent.ProximityPrompt
local entrancegate = script.Parent.Parent
local tweenservice = game:GetService("TweenService")
local uptween = tweenservice:Create(entrancegate.Arm, TweenInfo.new(1.5, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, false, 0),{["CFrame"]=entrancegate.ArmUp.CFrame})
local downtween = tweenservice:Create(entrancegate.Arm, TweenInfo.new(1.5, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, false, 0),{["CFrame"]=entrancegate.ArmDown.CFrame})
local openval = false
prox.Triggered:Connect(function(plr)
if plr:GetRankInGroup(35020333) >= 9 then
if openval then
downtween:Play()
openval = false
else
openval = true
uptween:Play()
end
end
end)
Hello. Thanks for replying. I’m not exactly sure where I need to put this in my script. So i’ve made a script that tweens it but it still does it wrong. I’m hoping you can tell me where I would put this?
local prox = script.Parent.ProximityPrompt
local model = game.Workspace.Map:FindFirstChild("EntranceGate")
local armUp = model.ArmUp
local armDown = model.ArmDown
local arm = model.Arm
local TweenService = game:GetService("TweenService")
prox.Triggered:Connect(function(plr)
if plr:GetRankInGroup(35020333) >= 9 then
local tween = TweenService:Create(arm, TweenInfo.new(2), {CFrame = armUp.CFrame})
tween:Play()
end
end)
Sorry I’m a bit of a rookie when it comes to tweening
Hello. This is the same result as the script i made for Happyas answer.
Here is a video of whats happening when i only want it to move up and down not side to side.
Sorry for the bad quality. But as u can see in the video the it doesnt react like a barrier would in real life. robloxapp-20250104-0158461.wmv (411.2 KB)
I tried testing with motor 6ds and discovered that they’re not going to work.
However, I did some further research and came up with a possible fix for your issue!
Step 1:
Insert a new part where you want the joint to be. Make sure this part is anchored, small, and transparent.
Step 2: Add a WeldConstraint instance under the new part. Make sure that the weld’s Part0 property is set to the new part and its Part1 property is set to the arm.
Step 3: Make sure the arm is unanchored.
Then all we need to do is to tween the rotation of the part and the arm will turn at that point!
You can work on setting that up and I’ll start on a script to tween it.
I’ve been working on the script, and I was able to reuse quite a bit of things from my first attempt:
local prox = script.Parent.ProximityPrompt
local joint = --the joint part (i don't know where you parented it)
local tweenservice = game:GetService("TweenService")
local uptween = tweenservice:Create(joint, TweenInfo.new(1.5, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, false, 0),{["Orientation"]="vector3 value of the orientation of the joint when open"})
local downtween = tweenservice:Create(joint, TweenInfo.new(1.5, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, false, 0),{["Orientation"]=joint.Orientation})
local openval = false
prox.Triggered:Connect(function(plr)
if plr:GetRankInGroup(35020333) >= 9 then
if openval then
downtween:Play()
openval = false
else
openval = true
uptween:Play()
end
end
end)