01 | function oc(pl, dc) |
02 | if (dc.Name = = "Yes" ) then |
03 | print ( "You own this tycoon!" ) |
04 | workspace.Tycoon.DoorHeader.UnownedPharmacy.Name = pl.Name.. "'s Tycoon" |
05 | if not pl.Name.hastycoon.Value then |
06 | pl.Name.hastycoon.Value = true |
07 | script.Parent.Parent.Parent.Parent.Parent.OwnerName.Value = pl.Name |
08 | end |
09 | end |
10 | if (dc.Name = = "No" ) then |
11 | print ( "You do not own this tycoon!" ) |
12 | end |
13 | end |
14 | 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!
01 | function oc(pl, dc) |
02 | if (dc.Name = = "Yes" ) then |
03 | print ( "You own this tycoon!" ) |
04 | workspace.Tycoon.DoorHeader.UnownedPharmacy.Name = pl.Name.. "'s Tycoon" |
05 | if not pl.Name.hastycoon.Value then |
06 | pl.hastycoon.Value = true -- Error was here |
07 | script.Parent.Parent.Parent.Parent.Parent.OwnerName.Value = pl.Name |
08 | end |
09 | end |
10 | if (dc.Name = = "No" ) then |
11 | print ( "You do not own this tycoon!" ) |
12 | end |
13 | end |
14 | 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.