Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Tycoons (Ontouched Door) Owner Script help!?

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)

3 comments

0

Don't you need another Parent? and why not just put your username into that space?

0

Its for a multiplayer tycoon, and if I put my username in it it wont work for others.

0

Any errors?

1 answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.