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.