[PROBLEM SOLVED]Need help with textbutton

EDIT: did it work for you?

Alright if it works for you then theres something wrong that i did.

It appears it works completely fine for me

Video 1 (Instance Locations):

Video 2 (Parts unanchored):

Video 3 (Parts anchored):

Video 4 (view of position and transparency of each part):

And I’m using the same exact script, no changes to it.

Edit:
Sorry for the wait time the video is taking long to process

could i see the script please?

where did you place the script at? :edit Nvm

1 Like

Location of the scripts and every other instance is in the first video. The second and third video displays how the system works with the parts anchored and unanchored.
Carefully look at the last video, and compare the Name, Transparency, and Position of each part in the video with your parts, and see if they match. If they do not match, then that may be the reason as to why the doors are not moving for you.

i checked everything the trasnparency everything and its not moving can i give u the file for the studio to check it?

Bus Open Doors Test.rbxl (2.5 MB) If you want to see.

Alright here is the file:

Bus Doors.rbxl (49.0 KB)
Let me know if you are able to open it

no it didnt it just put me on the home screen on studio

I looked into this file, and found that if you manually move one of the doors (using the move selection) while testing, only then it will start moving. So technically the script does work, but something is just wrong with the parts.

After reviewing the scripts you’re using I would suggest using Mechanical Constraints instead of Tweens. These allow the parts to be influenced by physics while moving and do not constrain them to specific value movements.

so what would i have to do to fix that? Edit: I found the problem the doors weren’t unanchored but I have a problem when I unanchored the parts there nowhere to be seen and i think thats because i unioned all the parts of the left bus doors and right into 1. And I finally got the download to work to see your version the only thing I don’t like the player can just move the doors and it glitches around.

1 Like

you should use HingeConstraints in each door you will need an attachment in each door to link it to and also one for each door in the base of the bus but aligned in same world position as the ones in the doors then set the attachment0 and attachement1 on each hingecontraint and select ActuatorType to Servo, this allows you to set the angle you want it the door to rotate to when open or close this will allow the bus to still move while doors operate etc without the limits of tweens

here is the link for more info, there are also videos that show you the function of motor and servo actuatortypes

Another way would be with welds/motor6d but I would suggest HingeConstraint instead

I think I have managed to fix the issue. I anchored all the unions in the models (with the server script), and it seems to be working fine now.
The only issue that I was facing was while the Right Door was opening, the entire bus also moves along with it (this does not happen with the Left Door). So you need to move the Right Door slightly away from the bus in order to fix that.

Here is the updated Server Script:

local TweenService = game:GetService("TweenService")

-- If you haven't already, insert a RemoteEvent to ReplicatedStorage and rename it to "DoorRequestEvent"

-- Create The RemoteEvent
--local newEvent = Instance.new("RemoteEvent")
--newEvent.Name = "DoorRequestEvent"
--newEvent.Parent = game.ReplicatedStorage
--print("The Remote event was made")


--timeout_number = 6

--local remoteEvent = game.ReplicatedStorage:WaitForChild("DoorRequestEvent")



--local openGoalTable = {} -- you could insert any goal value involving the instance you are tweening (example: you could change size, position, transparency etc just by inserting the values in this table
--local closeGoalTable = {} -- same with this

--openGoalTable.Position = openleftPosition -- adds value to table
--closeGoalTable.Position = closedLeftPosition 




-- BUS DOORS
local LeftBusDoor = script.Parent:WaitForChild("BusDoors"):WaitForChild("LeftBusDoor"):WaitForChild("LeftDoor")
local RightBusDoor = script.Parent:WaitForChild("BusDoors"):WaitForChild("RightBusDoor"):WaitForChild("RightDoor")

local LeftClosedInv = script.Parent:WaitForChild("BusDoors"):WaitForChild("LeftBusDoor"):WaitForChild("LeftClosedDoorInv")
local LeftOpenInv = script.Parent:WaitForChild("BusDoors"):WaitForChild("LeftBusDoor"):WaitForChild("LeftOpenDoorInv")

local RightClosedInv = script.Parent:WaitForChild("BusDoors"):WaitForChild("RightBusDoor"):WaitForChild("RightClosedDoorInv")
local RightOpenInv = script.Parent:WaitForChild("BusDoors"):WaitForChild("RightBusDoor"):WaitForChild("RightOpenDoorInv")


-- Function to handle the door movement

local function handleDoorRequest(player, doorOpen)
	print(doorOpen)


	print("Found the Bus doors")
	
	for _, doorObj in pairs(script.Parent.BusDoors:GetDescendants()) do
		if doorObj:IsA("BasePart") or doorObj:IsA("UnionOperation") then
			doorObj.Anchored = true
			--doorObj.CanCollide = false
		end
	end

	local openleftPosition = LeftOpenInv.Position 
	local closedLeftPosition  = LeftClosedInv.Position
	local openRightPosition	 = RightOpenInv.Position
	local closedRightPosition = RightClosedInv.Position

	local tweenInfo  = TweenInfo.new(1)

	local tweenLeftOpen = TweenService:Create(LeftBusDoor, tweenInfo, {Position = openleftPosition})
	local tweenRightOpen = TweenService:Create(RightBusDoor, tweenInfo, {Position = openRightPosition})

	local tweenLeftClose = TweenService:Create(LeftBusDoor, tweenInfo, {Position = closedLeftPosition})
	local tweenRightClose = TweenService:Create(RightBusDoor, tweenInfo, {Position = closedRightPosition})

	-- Move the doors based on the doorOpen parameter

	if doorOpen then
		tweenLeftOpen:Play()
		tweenRightOpen:Play()
		print("Door Opened")

		tweenRightOpen.Completed:Wait()
		LeftBusDoor.Position = LeftOpenInv.Position
		RightBusDoor.Position = RightOpenInv.Position
	else
		tweenLeftClose:Play()
		tweenRightClose:Play()
		print("Door Closed")

		tweenRightClose.Completed:Wait()
		LeftBusDoor.Position = LeftClosedInv.Position
		RightBusDoor.Position = RightClosedInv.Position
	end
end

-- Event listener for handling door requests
remoteEvent.OnServerEvent:Connect(handleDoorRequest)

Alright ill see if this script works tomorrow ill contact you if it does or doesnt. Good night :slight_smile:

1 Like

I’m sure it should now, as I tested this from the rbxl file you sent. See you tomorrow.
Btw, I’ll post a video right here showing the doors functioning properly once it’s processed.

Edit:

While testing again, I came across the same issue where the entire bus moves when the Right Door moves. The only way it stops is if you move the door (using the move selection from the model tab) while testing. I was unable to prevent this prior to starting the game.

I believe this could be happening due to a weld constraint (that could’ve been created in one of the scripts), though I searched through every weld and motor, but couldn’t find anything that could be causing the RightDoor to move the entire bus.
I will wait for your response tomorrow, but I don’t think I will be able to fix this issue.

1 Like

Hi i’m back I just put the new script in and there’s a red line at the end of the script on remoteEvent, fixed this already while you were gone. Edit i just tested the script yeah your right its moving the whole bus to. Maybe ill use diffrent door models and see if that works and if that doesnt work then its the bus. Edit I think its either the script or the bus because I changed the doors to parts and it still did the same thing. Edit 2: yeah its the script I checked everything nothing is welding the busdoors unless you tested it and it worked. respond me if you have an update to the script.

EDIT: THIS WAS FROM EALRLIER THE SCRIPT DOES INDEED WORK

1 Like

@BabyNinjaTime i got it working it was the doors but i dont want parts as doors ill try to union all the parts of the doors together. and when i open the doors the whole bus just breaks. So i think i might have to use mechanical constraints. Edit: idk how to use mechanical constraints so ill make a new post.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.