I have this dialog for an NPC in my game, and it works fine in studio. No errors, even when i run a 2 player session. However, it doesn’t seem to work when published, and I can’t figure out why. This is in a local script inside starter character scripts.
Dialog.DialogChoiceSelected:Connect(function(Plr,Choice)
local CurrentDurability = Player.leaderstats.CurrentDurability
local Durability = Player.leaderstats.Durability
local Gold = Player.leaderstats.Gold
if Choice.Name == "Yes" then
local Cost = (Durability.Value - CurrentDurability.Value)*0.25
if Cost > 0 then
Yes.ResponseDialog = "That will cost you "..tostring(Cost).." Gold."
It stops here, giving me “…”
The whole script is as follows:
Dialog.DialogChoiceSelected:Connect(function(Plr,Choice)
local CurrentDurability = Player.leaderstats.CurrentDurability
local Durability = Player.leaderstats.Durability
local Gold = Player.leaderstats.Gold
if Choice.Name == "Yes" then
local Cost = (Durability.Value - CurrentDurability.Value)*0.25
if Cost > 0 then
Yes.ResponseDialog = "That will cost you "..tostring(Cost).." Gold."
wait(1)
local NewDialog = Instance.new("Dialog",Npc.HumanoidRootPart)
NewDialog.GoodbyeChoiceActive = false
NewDialog.InitialPrompt = "Would you like me to fix it for you?"
local NewYes = Instance.new("DialogChoice",NewDialog)
NewYes.GoodbyeChoiceActive = false
NewYes.Name = "Yes"
NewYes.UserDialog = "Yes"
local NewNo = Instance.new("DialogChoice",NewDialog)
NewNo.GoodbyeChoiceActive = false
NewNo.Name = "No"
NewNo.UserDialog = "No."
NewDialog.DialogChoiceSelected:Connect(function(Plr,Choice)
if Choice.Name == "Yes" then
if Gold.Value - Cost >= 0 then
NewYes.ResponseDialog = "Alright."
EngineerEvent:FireServer()
NewDialog:Destroy()
if Player.Character.Humanoid:FindFirstChild("One")or Player.Character.Humanoid:FindFirstChild("Two") == nil then
print("Player has broken prosthetics")
BrokenCheck(Player)
end
elseif Gold.Value - Cost <= 0 then
NewYes.ResponseDialog = "Sorry, you don't have enough gold."
NewDialog:Destroy()
end
elseif Choice.Name == "No" then
NewNo.ResponseDialog = "See you."
NewDialog:Destroy()
end
end)
else
Yes.ResponseDialog = "You don't need repairs."
end
end
end)```