Roblox Scripting Tutorial: Tycoons Part 6 - Owner Door
Hey, guys. Today we're going to learn how to make an owner door. You guys have been asking for this one for a while.
Script:
-- The variable "owner" should be the Owner string value inside of your tycoon.
-- Point this variable toward that object.
local owner = script.Parent.Parent.Owner
-- Store the parent (the door) in a variable for later use.
local door = script.Parent
-- This function is called when a part touches the door.
door.Touched:connect(function(part)
-- This if statement checks to see if the parent of the part (ideally a player) that
-- touched the door is the same as the value stored in the owner variable.
if part.Parent.Name == owner.Value then
-- Allow the door to be passed through, make it translucent, and wait for the owner to pass
-- through before returning the door to normal.
door.CanCollide = false
door.Transparency = .8
wait(.8)
door.CanCollide = true
door.Transparency = 0
end
end)
Be sure to follow me on Twitter after rating, commenting, and subscribing!
https://twitter.com/Rrrrry123
Also, follow me on Twitch for some live streams!
http://www.twitch.tv/Rrrrry123
You can add me on Roblox here!
http://ow.ly/7MWs305jb3B
Want to help make this channel better? You can donate to me via Roblox Robux!
http://ow.ly/En9x30hdeWy
Other Videos By RyGuyGaming
Other Statistics
Roblox Statistics For RyGuyGaming
At present, RyGuyGaming has 459,946 views spread across 106 videos for Roblox, and roughly a days worth of Roblox videos were uploaded to his channel. This makes up 17.76% of the content that RyGuyGaming has uploaded to YouTube.