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!

local Players = game:GetService("Players")

local part = script.Parent
local function onTouched(part)
local player = Players:GetPlayerFromCharacter(part.Parent)
if not player then return end

if player.OwnershipStatus.Owner.Value == false then

script.Parent.Parent.Name = player.Name.."'s Tycoon"
script.Parent.Parent.Parent.Owner.Value = player.Name
script.Parent.CanCollide = false
player.OwnershipStatus.Owner.Value = true
print(player.Name.." Owns the Tycoon!")
else 
    print(player.OwnershipStatus.Owner.Value)
end
end

part.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