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

Tycoons (Ontouched Door) Owner Script help!?

Asked by 9 years ago

Okay, so I am currently making a Tycoon for a game, but the Become Owner script won't make me owner. I believe it has something to do with the on touched function. Can someone help me find the problem in this script? The Hierarchy is Script>Head>Become Owner>Factory>TycoonMaker>Workspace

local ting = 0 
owner = script.Parent.Parent.Parent.OwnerName
function onTouched(hit)
    if ting == 0 then
    ting = 1
    local check = hit.Parent:FindFirstChild("Humanoid")
        if check ~= nil then
            local thisplr = game.Players:findFirstChild(hit.Parent.Name)
            if (thisplr~=nil) then
                local ownstyc = thisplr:findFirstChild("Tycoon")
                if (ownstyc~=nil) then
                    if ownstyc.Value == 0 then
                        ownstyc.Value = 1
                        owner.Value = thisplr.Name
                        local message = script.Parent.NoticeTycoon:Clone()
                        message.Box.Label.Text = "You Now own a this tycoon."
                        message.Parent = thisplr.PlayerGui
                        wait(2)
                        message:remove()
                        repeat
                        wait()
                        script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0,-0.1,0)
                        until script.Parent.Position.Y < -5
                        script.Parent.Parent:remove()
                    elseif ownstyc.Value == 1 then
                        local message = game.Lighting.NoticeTycoon:Clone()
                        message.Box.Label.Text = "You already own a tycoon."
                        message.Parent = thisplr.PlayerGui
                        wait(3)
                        message:remove()
                    end
                end
            end
        end
    ting = 0
    end
end

script.Parent.Touched:connect(onTouched)
0
Don't you need another Parent? and why not just put your username into that space? LostPast 253 — 9y
0
Its for a multiplayer tycoon, and if I put my username in it it wont work for others. attackonkyojin 135 — 9y
0
Any errors? YellowoTide 1992 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

I think your problem is on line 2. I can't tell for sure since I can't see your explorer but values (your owner variable) need .Value after them to access their value.

this is line 2

owner = script.Parent.Parent.Parent.OwnerName.Value --just added .Value so now it will access that Values value (:P).
Ad

Answer this question