function oc(pl, dc) if (dc.Name == "Yes") then print("You own this tycoon!") workspace.Tycoon.DoorHeader.UnownedPharmacy.Name =pl.Name.."'s Tycoon" if not pl.Name.hastycoon.Value then pl.Name.hastycoon.Value=true script.Parent.Parent.Parent.Parent.Parent.OwnerName.Value=pl.Name end end if (dc.Name =="No") then print("You do not own this tycoon!") end end script.Parent.DialogChoiceSelected:connect(oc)
The function of this script is to allow a player to initiate dialog, and claim a tycoon, without being able to claim another. When I start the game and go through the dialog, the hastycoon value is not changed to true and I'm a little stuck as to why.
Thanks!
function oc(pl, dc) if (dc.Name == "Yes") then print("You own this tycoon!") workspace.Tycoon.DoorHeader.UnownedPharmacy.Name =pl.Name.."'s Tycoon" if not pl.Name.hastycoon.Value then pl.hastycoon.Value=true -- Error was here script.Parent.Parent.Parent.Parent.Parent.OwnerName.Value=pl.Name end end if (dc.Name =="No") then print("You do not own this tycoon!") end end script.Parent.DialogChoiceSelected:connect(oc)
I believe this should work. It was because you were trying to look inside the players name for the hastycoon value, instead of the player itself.
Make sure +1 and accept answer to help others.