hello everyone!, so i try make a hide other places in same game like ghost simulator / meepcity / pet simulator 2 i try make a mirror part for hide the other places and is no work… sombody know how can i hide other places inside my game with script? (i am trying to make a cloud world and i am no want players to see the baseplate or anything else that inside the game.) example: i am want to hide the lobby/spawn area from players that inside the desert world. but i am also want do that only to the players that inside the desert world and if they go to the spawn area so is show only the spawn area to the same player.
Not sure what you mean by this, could you elaborate?
If your places are models you can simply make a loop that makes them invisible, and once you want to use them you can make the same loop just that you make the part visible. Here is what I mean:
local function HideModel(Model)
for i,v in ipairs(Model:GetDescendants()) do
if v:IsA("BasePart") or v:IsA("Part") or v:IsA("MeshPart") then
v.Transparency = 1
end
end
end
for i,v in pairs(workspace:GetDescendants()) do
if v:IsA("Model") then
if v:FindFirstChild("ToHide") then
HideModel(v)
end
end
end
To make sure that the script work:
- Make sure that you insert this in a LocalScript. This will work in a ServerScript, but then the Model will be invisible in the Server and Client Side. You can choise if insert it in a ServerScript or a ClientScript.
- Insert a BoolValue in your Model that you will hide and name it to
ToHide
.
i am mean if player teleporting to location 1 so is show only location 1 and if he teleport to location 2 so is show only location 2 (check meepcity also for know what i am mean Note: in my game is no with TeleportService.)
also i am no have to change names in this script? or i am have to? also is can work to 3+ places too?
No. I edited my script to make that it make invisible the Parts but not the script, else it will trowed a error.
I can make it so that when a player teleports, only he can see it. And now if for example 4 players are teleported to the same location then the 4 players will see the same thing, but i need to see your teleporting script and the script should be a LocalScript, else all the players will be see the Model.
if inside the models is have more models?
ok so this is my teleport script: db = false
script.Parent.Transparency = 1
script.Parent.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if db == false then
if player.leaderstats.Level.Value >= 150 then
db = true
local Teleport = script.Parent.TeleportName.Value
local Pos = script.Parent.Parent.Parent.Teleports:findFirstChild(Teleport)
hit.Parent:moveTo(Pos.Position)
wait(1)
db = false
end
end
end)
make sure you add a string value to the teleport part for make that works.
If you can then make the boolean value inside all of the models, else wait a little bit, i will make a new script.
so there is a new script for the hide other worlds/locations? i try also make script that move the model to lighting when the player at another location and is no works… (your script no works)
local function HideModel(Model)
Model.Parent = game.ServerStorage.HidedModels --Make a folder and name it HidedModels
end
local function ShowModel(Model,Player)
game.ReplicatedStorage.RemoteEvent:FireClient(Player,Model)
end
local function ControlModels(HideBoolean, Player)
for i,v in pairs(workspace:GetDescendants()) do
if v:IsA("Model") then
if v:FindFirstChild("ToHide") then
if HideBoolean == true and not Player == nil then
HideModel(v)
else
ShowModel(v,Player)
end
end
end
end
end
db = false
script.Parent.Transparency = 1
ControlModels(true, nil)
script.Parent.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if db == false then
if player.leaderstats.Level.Value >= 150 then
db = true
local Teleport = script.Parent.TeleportName.Value
local Pos = script.Parent.Parent.Parent.Teleports:FindFirstChild(Teleport)
ControlModels(false,player)
player.Character:SetPrimaryPartCFrame(CFrame.new(Pos.Position))
wait(1)
db = false
end
end
end)
[[LocalScript]]
game.ReplicatedStorage.RemoteEvent.OnClientEvent(function(player, model)
model.Parent = workspace
end)
the first script put inside the teleport part/pad?
You muss create a RemoteEvent in the ReplicatedStorage.
Lighting is no a Service in the insert Models, try with ServerStorage.
Yes, and the LocalScript you can put it into the player.
thanks i am now testing and check if that actually works.
Sorry, i forgot to add the player parameter. I uppdated the code.
i am have to change anything here:
game.ReplicatedStorage.World.OnClientEvent(function(player, model)
model.Parent = workspace
end)
the bug is in the local script
FireClient require the Client to fire and a tuple of arguments, i forgot to add the client In the serverscript.