Hello there,

I am trying to make it so when a Player has selected the right DialogChoice, a door in Workspace opens. The only problem is: It does not work.

This is the script I am using right now. (it's a regular Script inside the Dialog which is inside the Head of an NPC)


local lasers = script.Parent.Parent.Parent["Wall_Laser"]:WaitForChild("Field")
local opened = false

script.Parent.DialogChoiceSelected:Connect(function(player, Choice)
	if Choice.Name == "A3 X" then
		if opened == false then
			opened = true
	
			for i = 1,8 do
				lasers.Transparency = lasers.Transparency + 0.075
				wait(0.005)
			end
			lasers.CanCollide = false
		end
	end
end)

For some reason, the script only works in Studio, but not in an actual server. ~ Note: no errors.

Thanks in advance.

Greetings, Milan G.

1 comment

0

You will have to use a remote and FireServer because the server will know then and copy and paste the script in the OnServerEvent