How to make Gui Tool System?

question, is the door supposed to Not Close but the other ones do?

Yeah, I didnā€™t add some code for it to close. Iā€™ll write that and add it below:

Edit:
Replace the code in the module script named Interact with this:

local TweenService = game:GetService("TweenService")

local isOpen = false
local canInteract = true
local hasAllItems = false

local function interact(player, settingsFolder)
	local requiredItems = settingsFolder.RequiredItems
	
	local requiredItemsFolder = settingsFolder.RequiredItems
	local multiUseItems = requiredItemsFolder.MultiUse
	local singleUseItems = requiredItemsFolder.SingleUse
	
	local movingPart = settingsFolder.MovingPart.Value
	local initialCFrame = settingsFolder.FirstPositionPart.Value.CFrame
	
	local finalCFrame = settingsFolder.SecondPositionPart.Value.CFrame
	
	local itemsFolder = player:FindFirstChild("Items")
	if not itemsFolder then
		return false
	end
	
	if not hasAllItems then
		hasAllItems = true
		for _, child in ipairs(multiUseItems:GetChildren()) do
			if not itemsFolder:FindFirstChild(child.Name) then
				hasAllItems = false
			end
		end
		for _, child in ipairs(singleUseItems:GetChildren()) do
			local item = itemsFolder:FindFirstChild(child.Name)
			if not item then
				hasAllItems = false
			else
				item:Destroy()
				child:Destroy()
			end
		end
	end
	
	
	if hasAllItems and canInteract then
		
		canInteract = false
		
		local goal
		if isOpen then
			goal = initialCFrame
		else
			goal = finalCFrame
		end
		
		local tween = TweenService:Create(movingPart, TweenInfo.new(0.5), {CFrame = goal})
		tween:Play()
		
		isOpen = not isOpen
		
		local connection
		connection = tween.Completed:Connect(function()
			canInteract = true
			
			connection:Disconnect()
			tween:Destroy()
		end)
	end
end

return interact

Edit:

Youā€™ll probably need to learn how to code to do that. There probably arenā€™t any models that do exact what you want, since itā€™s pretty specific to your game.

1 Like

TYSM!!
@PersonifiedPizza
I got a question, do you know how to make an NPC (a skinned mesh rig) Act like slender man
What I mean is the NPC Popping up at certain points in the map and as you progress and it can have jump scares as well.

for example Iā€™m walking down a forest and I get jump scared by the NPC, BUT I dont get Killed or hurt if I touch the AI. Then I can get Chased at a certain point in the map (Flat area) and when I get caught I get Hurt or Killed.

Jumpscares can be like
Pop up
Gui
Sound
(All of those at random)

so basically 2 NPCā€™s
1- Jumpscares you at times, and at CERTAIN time/Areas in the map
2- One that chases you and disapears after you get to a certain point, or after a certain amount of time (I personally want both depending on where I am at in the game same thing with jump scare (Depending where I am at.))

I just wanna know how this can be made possible and where I can learn to make it or find a model?

The code given doesnt work at all. I tested

I tested it and it worked. Hereā€™s how you should set it up:

  • Set up the door like normal
  • Open the module script named ā€œInteractā€
  • Select all the code inside it and paste it over

Are you getting errors or anything?


Edit:

No worries. Iā€™d double check the values of the FirstPositionPart and the SecondPositionPart. Make sure that the FirstPositionPart is in the position+orientation of the closed state.

Here is a place file with a working door:

HGSD Example Door.rbxl (71.0 KB)


Edit:
@Officerbruh0987

If possible, could you send me a DM? Weā€™re not really suppose to bump topics this much.

I didnā€™t add a way to add sounds, though itā€™s not that hard to add.

  1. Replace the Interact ModuleScriptā€™s code with:
local TweenService = game:GetService("TweenService")

local isOpen = false
local canInteract = true
local hasAllItems = false

local sound = script:WaitForChild("Sound") -- Added sound reference

local function interact(player, settingsFolder)
	local requiredItems = settingsFolder.RequiredItems
	
	local requiredItemsFolder = settingsFolder.RequiredItems
	local multiUseItems = requiredItemsFolder.MultiUse
	local singleUseItems = requiredItemsFolder.SingleUse
	
	local movingPart = settingsFolder.MovingPart.Value
	local initialCFrame = settingsFolder.FirstPositionPart.Value.CFrame
	
	local finalCFrame = settingsFolder.SecondPositionPart.Value.CFrame
	
	local itemsFolder = player:FindFirstChild("Items")
	if not itemsFolder then
		return false
	end
	
	if not hasAllItems then
		hasAllItems = true
		for _, child in ipairs(multiUseItems:GetChildren()) do
			if not itemsFolder:FindFirstChild(child.Name) then
				hasAllItems = false
			end
		end
		for _, child in ipairs(singleUseItems:GetChildren()) do
			local item = itemsFolder:FindFirstChild(child.Name)
			if not item then
				hasAllItems = false
			else
				item:Destroy()
				child:Destroy()
			end
		end
	end
	
	
	if hasAllItems and canInteract then
		
		canInteract = false
		
		local goal
		if isOpen then
			goal = initialCFrame
		else
			goal = finalCFrame
		end
		
		local tween = TweenService:Create(movingPart, TweenInfo.new(0.5), {CFrame = goal})
		tween:Play()
		
		isOpen = not isOpen
		
		sound:Play() -- Added Play function

		local connection
		connection = tween.Completed:Connect(function()
			canInteract = true
			
			connection:Disconnect()
			tween:Destroy()
		end)
	end
end

return interact
  1. Add a Sound to the Interact ModuleScript
  2. Name the Sound ā€œSoundā€
  3. Set the soundā€™s content ID (specify with sound to play)

Let me know if the sound doesnā€™t play, I may have messed up the position of the sound in the hierarchy. I believe it should play as a global sound currently (same volume everywhere). To make it not global weā€™d need to use an ObjectValue, which can be kind of confusing.

No worries. Itā€™s not exactly a rule rule, itā€™s just something that mods want people to do to stop topics from being bumped too much.

1 Like

Have a system where you can store objects in another ā€œBackpack Alternativeā€ such as a Folder instance inside the Player name like ā€œitemsā€.

That way, have the script access that folder, and that folder would not be able to be like a Backpack or items inside the folder canā€™t be equipped nor unequipped.

1 Like

lemme re-try it, I will see if I get any errors.

1 Like

It is still not working and I tried the code from the other door and it still wont work.
Video:2022 01 23 16 24 41 - YouTube

(Replied to myself again Sighā€¦)

It is still not working and I tried the code from the other door and it still wont work.
Video:2022 01 23 16 24 41 - YouTube

Sorry that I said the same thing but I replied to the wrong person on accident lol

It worked, thank you so much! Iā€™ll let you know if I have any future questions about this.

1 Like

question, what if I want to have no tools to unlock, would I just put no folders in the required Items? @PersonifiedPizza

also, can I have the a proximity Prompt for the Doors (to open and close) and to pick up objects (interactable items).

because I was looking at the code for the ā€œInteractable Scriptā€ in the Door

Edit2: I just figured the Proximity Prompt one.

Edit3: i just figured out the no tool thingy I was asking :laughing:

I figured everything out so I basically answered my own question, my bad.

1 Like

Question, would there be a way I could add open/close sounds for the doors?

okay, thank you! and yes I will make a DM if I have any questions. Sorry, I didnt know about the rules of having a topic this long sorry.