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

How To Add Tycoon Owner Only?

I'm making a tycoon with this script but how will i add to make this like only the tycoon owner can click the button?

function onClicked()
             script.Parent.Parent.Door.Transparency= 0.5
             script.Parent.Parent.Door.CanCollide= false
             wait(3)
             script.Parent.Parent.Door.Transparency= 0
             script.Parent.Parent.Door.CanCollide= true
end
 script.Parent.ClickDetector.MouseClick:connect(onClicked)

1 answer

✓ Accepted answer

What you could do is store the tycoon owner's name in a StringValue (in the tycoon model) when they take ownership of the tycoon. For example, we could do this to reference it. However, you'd need to change the hierarchy of 'data' yourself to match you explorer.

local data = script.Parent.Parent.Owner;
function clickRegister(plr)
if(data.Value == plr.Name) then
script.Parent.Parent.Door.Transparency = 0.5;
script.Parent.Parent.Door.CanCollide = false;
wait(3);
script.Parent.Parent.Door.Transparency = 0;
script.Parent.Parent.Door.CanCollide = true;
end;
end;
script.Parent.ClickDetector.MouseClick:connect(clickRegister);

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