So, I've been working on the following script for a while:
local elevator = game.Workspace.Elevator --shorter for typing purposes
--this is a short for loop to find the first Part in the elevator
for i, v in pairs(elevator:GetChildren()) do
if v:IsA("BasePart") then --all part types inherit from basepart therefore they're all baseparts
elevator.PrimaryPart = elevator.door2 -- set the primary part
break -- break statement will stop the for loop and go back up scope
end
end
function onClicked()
elevator.door2.CanCollide = true
for i = 1, 20, 1 do
elevator.door2.Transparency = elevator.door2.Transparency - .05
wait(.05)
end
for i = 1, 800 do
elevator:SetPrimaryPartCFrame(elevator:GetPrimaryPartCFrame() * CFrame.new(0, -0.1, 0))
wait(.01)
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
How can I make this script be performed when a DialogChoice/Dialog is selected? Rather than functioning onClicked, would it be something like DialogChoiceSelected?

1 comment
Please use the Lua Block for your code. This is done by Press the Blue Icon that say's "Lua" and pasting your code in-between the "~~~~~" lines.