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

Can i script an owned tycoon?

Error: 08:34:23.313 - Tycoon is not a valid member of Model

I made an owns tycoon but it works on roblox studio but not on the server. I will show you the script:

script.Parent.Touched:Connect(function()
	script.Parent.Parent.Parent["Nobody's Tycoon"].Name = game:GetService("Players").LocalPlayer.Name.. "'s Tycoon"
	local ownedtycoon = script:Destroy()
	if ownedtycoon then
		script.Parent.Parent.Parent["Nobody's Tycoon"].Name = script.Parent.Parent.Parent["Nobody's Tycoon"].Name
	end
end)

1 answer

Rookie mistake.

script.Parent.Parent.Parent.Tycoon.Name = "Nobody's Tycoon"
local ownstycoon = script.Parent.Parent.Parent.Tycoon

The problem is that you named the Model Nobody's Tycoon right before you defined it, so it's not named Tycoon anymore. You need to define it by it's name so it'd look like this:

script.Parent.Parent.Parent.Tycoon.Name = "Nobody's Tycoon"
local ownstycoon = script.Parent.Parent.Parent["Nobody's Tycoon"]

But you could just make it look simpler and name ownstycoon after you define it:

local ownstycoon = script.Parent.Parent.Parent.Tycoon
ownstycoon.Name = "Nobody's Tycoon"

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