I am creating a house small on the inside big on the outside!!! Please help me.
From how I read it, you want to make something like were you go into a large building, and you get teleported to a smaller building in the game.
This can be done through setting a CFrame and the .Touched event. First, you want a hitbox around the door, this will be the part a player touches to enter the house. In properties, set CanColide to False and Transparency to 1.
Inside the hitbox add a script. In the script, delete the print("Hello World!")
Add a part where it will teleport you to when you exit / enter away from the hitbox, so the player wont exit / enter the building and teleport back in due to touching the hitbox. Make this transparency to 1 and cancollide to false
Rename the part to something like House1Exit / House1Enterance .
In the script, put the code as:
local Target = workspace:FindFirstChild("Target Parts Name Here") -- Replace "Target Parts Name Here" with the name off the part, such as local Target = workspace:FindFirstChild("House1Enterance") script.Parent.Touched:Connect(function(Hit) if game.Players:GetPlayerFromCharacter(Hit.Parent) then -- The player is real, it's not something like an unanchored part falling on it. Hit.CFrame = Target.CFrame end end)
Now, repeat this for the exit.
Code Explanation
local Target = workspace:FindFirstChild("Target Parts Name Here") -- Replace "Target Parts Name Here" with the name off the part, such as local Target = workspace:FindFirstChild("House1Enterance")
From this, I am declaring the Target, which should be a base part as the first child found with the name you put in, this should be the part you made to teleport the player to.
script.Parent.Touched:Connect(function(Hit)
This simply will cause the code up until end)
to run when the part is touched, this can be anything from a player to an unanchored part falling onto it. It then returns Hit as a value off what touched it.
if game.Players:GetPlayerFromCharacter(Hit.Parent) then
This will run the code up untill end
if the game can get a player from the Parent off hit, if not the code won't run. This is usefull to add because it prevents things such as unanchored parts running the code due to it checking if it is actually a player touching it.
Hit.CFrame = Target.CFrame
This will simply set the CFrame off the part that Hit the hitbox to the Targets CFrame, teleporting the Player.
Some Usefull links
Are you wanting to teleport somewhere in your game?? Here is my model Model
Or do you want to teleport to another game?? Here is my other model. Model
I would recommend to look how I coded it
Just set the primarypart cframe to wherever you want to teleport them to
Model:SetPrimaryPartCFrame()
--inside a touched script or whatever local teleportedYet = false task.spawn(function() repeat task.wait() until teleportedYet teleportedYet = false Model.Humanoid.Walkspeed = 16 end) local targetcf = CFrame.new()--your target Model.Humanoid.Walkspeed = 0 Model:SetPrimaryPartCFrame(cf) teleportedYet = true