Dialog Help - Part Not Spawning

  1. What do you want to achieve? Keep it simple and clear!
    I want a LocalScript to spawn a part once a DialogChoice fires DialogChoiceSelected
  2. What is the issue? Include screenshots / videos if possible!
    The part does not spawn.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Not many.

Here is the script I’m using:

script.Parent.DialogChoiceSelected:Connect(function()
	local part = Instance.new("Part")
	part.Position = CFrame.new(0, 10, 0)
	part.Color = Color3.new(0,1,0)
end)

you forgot to parent the part to workspace, try

local Part = Instance.new("Part",workspace)

or

local Part = Instance.new("Part")
Part.Parent = workspace

2 mistakes. You’re not parenting part to workspace. A part needs to be a child of workspace to show up. Also, you are setting it’s Position to a CFrame. This will not work. Position takes a Vector3, so either switch it to part.CFrame or switch the CFrame to a Vector3.new(x,y,z). Also a good idea to anchor it.

script.Parent.DialogChoiceSelected:Connect(function()
	local part = Instance.new("Part", workspace)
	part.Position = Vector3.new(0,10,0)
	part.Color = Color3.new(0,1,0)
    part.Anchored = true
end)
2 Likes

bro there isnt a position library in luau what ru doin :sob:

heres the fixed script:

script.Parent.DialogChoiceSelcted:Connect(function()
    local part = Instance.new("Part")
    part.CFrame = CFrame.new(0, 10, 0)
    part.Color = Color3.fromRGB(0, 255, 0)
    part.Anchored = true
    part.Parent = workspace
end)

Yes, there is, it’s just hidden from the Properties tab

im talking about how he put Position.new and position isn’t a library in luau, and yes i know it is a property, its not a library though

1 Like

LMAOO I didn’t even notice that in his message lmao I was like “what position library is this dude even talking about” sorry bro :sob: :sob:

its ok dude aaaaaaaaaaaaaaaaaaaaaaaaa

Oh whoops. You’re right. My bad, should ofc be Vector

I did both of these fixes and it still does not show up. Maybe I’m using it on a DialogChoice?

This object should work for you.
DialogBrick.rbxm (4.4 KB)

that is totally right but its recommended to parent it to the workspace when u done the logic

1 Like

btw, setting the parent before setting all the other properties is bad practice. it causes some performance issues so i recommend setting the parent of the part after you’ve set all the other properties

1 Like

It works on just a Dialog object, but not with a DialogChoice. There’s an exception that says this when you try this with a DialogChoice object:

DialogChoiceSelected is not a valid member of DialogChoice.

I think I just realized why it’s not working.

Just use the file I sent, it works fine.