Help On Opening Wall

Hello, can you help me to make opening wall?
What I want to achieve is so when I touch a part, the wall will split and make open
illustration down below:
image
Before touching the part
image
After touching the part

My code:

local part = game.Workspace.Part
local rightdoor = game.Workspace.RightDoor
local rightdoorfinish = game.Workspace.RightDoorFinish
local leftdoor = game.Workspace.LeftDoor
local leftdoorfinish = game.Workspace.LeftDoorFinish
local bodyposition1 = game.Workspace.RightDoor.BodyPosition
local bodyposition2 = game.Workspace.LeftDoor.BodyPosition

part.Touched:Connect(function()
	print("WWWWWWWWWWWWWWWWWWWW") --to make sure its working, it does work but the function below not working
	bodyposition2.Position = leftdoor
	wait(2)
	bodyposition2.Position = leftdoorfinish
end)

Thanks!

2 Likes

i think you are trying to set a vector3 with a instance.
any error s?

1 Like

No errors, the print does work tho. I dont know whats wrong with my code, I just want to make the wall split (and also animated btw)

maybe set CanCollide and Transparency
to look like the wall is broken?

1 Like

which block? the finish one or the moving one? if its the moving one then whats the point of making it moving?

still not working :confused: any more ideas?

then maybe use tween service

Lets try that, I had that in my first idea but like, nah. but now, lets try it!

You doesn’t detect what’s actually hitting the wall. You need to add parametr to touched event.

Also you must to change position of bodyPosition, through instances position instead instance.

local part = game.Workspace.Part
local rightdoor = game.Workspace.RightDoor
local rightdoorfinish = game.Workspace.RightDoorFinish
local leftdoor = game.Workspace.LeftDoor
local leftdoorfinish = game.Workspace.LeftDoorFinish
local bodyposition1 = game.Workspace.RightDoor.BodyPosition
local bodyposition2 = game.Workspace.LeftDoor.BodyPosition

part.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
       print("WWWWWWWWWWWWWWWWWWWW") --to make sure its working, it does work but the function below not working
	   bodyposition2.Position = leftdoor.Position
	   wait(2)
	   bodyposition2.Position = leftdoorfinish.Position
    end
end)
1 Like

oh man, what a dumb mistake :slightly_smiling_face: lets try

AHHHHH, Not working :confused: lets try tween

I gave up with this I cant do it :broken_heart: :broken_heart: :broken_heart:

Try this:

local TweenService = game:GetService("TweenService")

local part = script.Parent
local leftdoorfinish = game.Workspace.LeftDoorFinish  

local Info = TweenInfo.new(
	1, 
	Enum.EasingStyle.Linear, 
	Enum.EasingDirection.InOut,
	0,
	false,
	0
)

local properties = {
	Position = leftdoorfinish.Position
}

part.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid")then
		local tween = TweenService:Create(part, Info, properties)
		tween:Play()
	end
end)
2 Likes

Okay Man, Will try, thanks for your help!

EYYYYYYYYYYYYYYY, Its working! Thank you so much!

I am glad, i could to help you. Don’t give up. Every scripter learns from his mistakes. If you don’t know something, just search DeveloperHub or Devforum. If you haven’t found any solution to your problem, just ask in the forum. Nobody knows everything.

Good luck in design your game!

DeveloperHub
Roblox Api Documentation

2 Likes

Thanks for the inspiration, You are so kind. Nice to meet you!

2 Likes