That’s not a style. That’s just bad coding standards. No indentations. It’s hard to read and harder to maintain. Also the script is sent as a photo and not as a codeblock. That makes it more difficult to help.
I’d also recommend using Tweens since that would be smooth as Extrenious has mentioned. @Ge_inki How many bollards are there? Are they considered a group or each bollard is an individual part?
I’ve gone ahead and formatted the code into a codeblock for ease of reading. Are you using some sort of template or script that was made for something else?
Speed = 2.5 – Speed at which the door rises. Higher = faster.
Time = 10 – Time between the door totally open and starting to close.
Running = false
for x,z in pairs(script.Parent.Parent:getChildren()) do
if z.Name == “Button” then
z.CD.MouseClick:connect(function ()
if Running == true then return end
Running = true
for i=1,script.Parent.Size.z/Speed*9+1 do
script.Parent.CFrame = script.Parent.CFrameCFrame.new(0,0,-0.1Speed)
script.Parent.Parent.Button.BrickColor = BrickColor.new(“Bright red”)
wait()
end
wait(Time)
for i=1,script.Parent.Size.z/Speed*9+1 do
script.Parent.CFrame = script.Parent.CFrameCFrame.new(0,0,0.1Speed)
script.Parent.Parent.Button.BrickColor = BrickColor.new(“Bright green”)
wait()
end
Running = false
end)
end
end
I’d recommend checking out the developer hub. You’ll want to look into the TweenService. For what you’re trying to do I’d also recommend learning how to use FindFirstChild, WaitForChild, and looking through the workspace for your bollards.
From there you’ll need to make a tween for your bollards that move them up or down. This should be based on Coordinate Frames or CFrames, This could have the caveat of messing with the collisions though, so perhaps modifying the Position instead would be better. Currently it’s like 2AM here, and I have no intentions on writing a script. If someone else is interested they can do so. However, I believe my recommendations should push you in the right direction.
Some basic knowledge of Lua or previous experience in programming may be neccessary. You can always reply to this post and the community will be there to help.
Just so this is buried in the public record, @Ge_inki was asking for scripting support using an experience that is entirely place stolen (places can be stolen using any popular executor). Of course, these executors don’t catch (server) scripts, only parts, so here he is desperately trying to get scripting support for his non-functional, stolen game. Myself and other developers worked hard to create the original game. This is me in studio in the legitimate copy, and you can cross-reference this with his image he initially posted of him in the same location.