What do I want to achieve?
In a horror game I’m making, I want a model I made to disappear when a player get to a certain point, I specifically need it to be a model though.
What steps have I taken to achieve this?
I tried ungrouping the model and adding a big invisible part for the player to touch before it disappears, then I tryed YouTube but there weren’t any tutorials on how to make models disappear.
Can anyone help? Please be very descriptive, as I know pretty much nothing about scripting.
Do you want other players to be able to see the model after one player has touched the model? or do you want the model to disappear fully for all players, regardless of whether they touched it or not?
Because if you want other players to see it then the script has to be inside a localScript, but if you to get rid of it for all players then it must be in a normal script.
There are some several steps to make something or in your case model disappear. You could either
Remove the Model entirely using :Destroy()
Change every part inside of the model invisible using Transparency
Here is one of the examples. This function would destroy the model if player touches the part that trigger the touched event.
local Part = "TRIGGER PART HERE" -- Touch Part
local Model = "MODEL HERE" -- Model
Part.Touched:Connect(function(Hit) -- Check if something touch the trigger part
local Player = game:GetService("Players"):GetPlayerFromCharacter(Hit.Parent)
if Player then -- Check if it is the player that touches it
Model:Destroy() -- Destroy the model for good
end
end)
No, don‘t set it to Lighting. This isn‘t an good place for store instances. Just change its parent to the ServerStorage. It will be „erased“ of the game, you will gain more speed and it will be in a sure place.
I know you can do it, but how? Like I said, I know nothing about scripting. Where do I put the script? In the model itself or somewhere else, is it local script or a regular script?
No I’m pretty sure you can use normal scripts. I think he means he’s going for 1 player servers, not having many players in one server and placing them in different maps.
Then you should do this
Place this script inside Workspace.
local Model = game.Workspace.Model -- you must reference your Model correctly!
local children = Model:GetDescendents ()
for i, v in pairs (children) do
v.Touched:Connect(function(hit)
local Players = game:GetService("Players")
local PlayerTouched = Players:GetPlayerFromCharacter (hit.Parent)
if PlayerTouched then
Model:Destroy()
end
end
end
Also, if I make the model non collide, will it still delete like it’s supposed to? I don’t want the player to be suddenly stopped by an object and then it disappears.