Entry Point like Prompt System

I just wanted to upload this incase anybody wanted to do something similar to the Prompt System like seen in Entry Point.
I won’t be updating anything or whatever because something froze my roblox studio and I’m not sure what the problem was.
I might come back to improve it but probably not as of right now.

Anyways, here is the module:
Prompt.rbxm (8.2 KB)

It is to be required on the client side and just set everything to the things you want them to be, all the properties having “Function” in them are supposed to be functions, they will be called everytime, code example:

local promptModule = require(script:WaitForChild("Prompt"))

for cloneIndex = 1, 15 do
	local newDuplicate = promptTextTemplate:Clone()
	newDuplicate.Visible = false
	newDuplicate.Changed:Connect(function(property)
		if property == "TextBounds" then
			newDuplicate.ProgressBar.Size = UDim2.new(0, newDuplicate.TextBounds.X + 4, 0, newDuplicate.TextBounds.Y, 0)
		end
	end)
	newDuplicate.Parent = promptsContainerFrame
end

promptModule.PromptStartFunction = function(promptConfig : Configuration, ...)
	task.spawn(function()
		promptFunction:InvokeServer("Start", promptConfig)
	end)

		local promptsContainer = promptConfig.Parent
		if typeof(promptsContainer) == "Instance" and promptsContainer:IsA("Folder") then
			local promptsTable = promptsContainer:GetChildren()
			local promptIndex = table.find(promptsTable, promptConfig)
			
			local textLabel
			local index = 0
			for i, text in pairs(promptsContainerFrame:GetChildren()) do
				if text:IsA("TextLabel") then
					index += 1
					local selfIndex = index
					if selfIndex == promptIndex then
						textLabel = text
						break
					end
				end
			end
			
			if typeof(textLabel) == "Instance" and textLabel:IsA("TextLabel") then
			local totalTime = promptModule["PromptsProgress"][promptConfig] or 0 --progress + (tick() - sendTick)
				repeat totalTime += RunService.RenderStepped:Wait()
					local percentage = totalTime / promptConfig:GetAttribute("ActivationTime")
					textLabel.ProgressBar.UIGradient.Transparency = numberSequenceFromPercentage(percentage, 1, 0)
				until totalTime >= promptConfig:GetAttribute("ActivationTime") or promptModule["InteractionWithPrompt"] ~= true
			end
		end
end

promptModule.PromptFinishFunction = function(promptConfig : Configuration, completed : boolean, ...)
	print("Prompt Finish Function", promptConfig, ...)
	task.spawn(function()
		local answer = promptFunction:InvokeServer("End", promptConfig)
	end)
	
	local promptsContainer = promptConfig.Parent
	if typeof(promptsContainer) == "Instance" and promptsContainer:IsA("Folder") then
		local promptsTable = promptsContainer:GetChildren()
		local promptIndex = table.find(promptsTable, promptConfig)

		local textLabel
		local index = 0
		for i, text in pairs(promptsContainerFrame:GetChildren()) do
			if text:IsA("TextLabel") then
				index += 1
				local selfIndex = index
				if selfIndex == promptIndex then
					textLabel = text
					break
				end
			end
		end

		if typeof(textLabel) == "Instance" and textLabel:IsA("TextLabel") then
			textLabel.ProgressBar.UIGradient.Transparency = NumberSequence.new(1)
		end
	end
end

promptModule.AdditionalPromptChangeFunction = function(...)
	print("Additional Prompt Change Function", ...)
	local selectedPromptPart = promptModule["CurrentlyActivePrompt"]

	if typeof(selectedPromptPart) == "Instance" and selectedPromptPart:IsA("BasePart") then
		local promptsContainer = selectedPromptPart:FindFirstChild("PromptsContainer")
		if typeof(promptsContainer) == "Instance" and promptsContainer:IsA("Folder") then
			interactionObjectText.Text = promptsContainer:GetAttribute("ObjectName")
			
			promptFrame.Visible = true
			
			local promptsTable = promptsContainer:GetChildren()
			local index = 0
			for i, text in pairs(promptsContainerFrame:GetChildren()) do
				if text:IsA("TextLabel") then
					index += 1
					local selfIndex = index
					local promptConfig = promptsTable[selfIndex]
					if typeof(promptConfig) == "Instance" and promptConfig:IsA("Configuration") then
						text.Visible = true
						local prefix = ""
						if promptConfig:GetAttribute("ActivationTime") > 0 then
							prefix = "Hold ["
						else
							prefix = "Press ["
						end
						text.Text = prefix .. Enum.KeyCode:FromValue(promptConfig:GetAttribute("KeyboardInteractionKey") or 1).Name .. "] to " .. promptConfig:GetAttribute("ActionText") .. " " .. promptsContainer:GetAttribute("ObjectName")
						text.ProgressBar.UIGradient.Transparency = numberSequenceFromPercentage(0, 1, 0)
						
						if promptConfig:GetAttribute("Enabled") == true then
							text.TextColor3 = Color3.fromRGB(255, 255, 255)
						else
							text.TextColor3 = Color3.fromRGB(50, 50, 50)
						end
					end
				end
			end
		else
			promptFrame.Visible = false
		end
	else
		promptFrame.Visible = false
	end
end

promptModule.EnableModule(true)

And for example, the Mouse property must always be rather nil or a Players Mouse (the Mouse instance), if it is a Mouse, the raycast will go into the direction the mouse is pointing at.
The origin property is from where the raycast originates, can be any instance that has a CFrame, so a Camera, BasePart or (not recommended) an attachment. (origin.CFrame.Position)
WorldRoot is as the name implies, the WorldRoot of which the raycast is being done on, so you can simulate a minigame inside of a ViewportFrame. (I haven’t tested it tho)

I left an example part to use it on inside of the module, just place it inside the workspace and change the RaycastFilterInstances to whatever the RaycastParams.new().FilterDescendantsInstances should be.

Look inside the module for extra comments incase there might be something unclear or ask me about it.

Feel free to modify it.

3 Likes

Any example pics of it working?

Like I said, the problem I had was with server to client communication which crashed my game but I can try to make it work again, give me like 5 minutes.


This is an example usage of the module

2 Likes

Oh yeah, I forgot to show/mention that you can turn around and still be holding down the button to trigger the prompt.

Is it a feature or bug can’t tell :rofl: :heavy_check_mark:

No, its on purpose, thats how Entry Point did it, it allows players to look around if some enemy is coming and what to do, but Entry Point lets a player only turn there camera to a certain angle.
Thats kinda the whole point of why I made it.