Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How is my returned value the same as the compared value, but not running?

Asked by 5 years ago

Hi there! Very new to scripting. What am I doing wrong here? My output has not been "Owns the tycoon" and only returns multiples of "False." I've replaced "if player.OwnershipStatus.Owner.Value == false" with other qualifiers and those have all worked, but not this. Any help would be appreciated!

01local Players = game:GetService("Players")
02 
03local part = script.Parent
04local function onTouched(part)
05local player = Players:GetPlayerFromCharacter(part.Parent)
06if not player then return end
07 
08if player.OwnershipStatus.Owner.Value == false then
09 
10script.Parent.Parent.Name = player.Name.."'s Tycoon"
11script.Parent.Parent.Parent.Owner.Value = player.Name
12script.Parent.CanCollide = false
13player.OwnershipStatus.Owner.Value = true
14print(player.Name.." Owns the Tycoon!")
15else
16    print(player.OwnershipStatus.Owner.Value)
17end
18end
19 
20part.Touched:Connect(onTouched)
0
you use local part = script.Parent and part = Part Touched its the same name. change the variable name that not the same name. OnaKat 444 — 5y
0
Thank you! I did that as well as add "" around false and that fixed it! OswinFalls 69 — 5y

Answer this question