Hello i want to make a model when you click on a button 1 player can see what happend (the one who clicked the button) and the other players can't see it because they have to click on the button.
Can someone help me with this?
function onClicked() if script.Parent.Value.Value == true then script.Parent.Value.Value = false script.Parent.BrickColor = BrickColor.new("Bright red") script.Parent.Parent.Parent.lightning.ParticleEmitter.Enabled = false script.Parent.Parent.Parent.lightning2.ParticleEmitter.Enabled = false script.Parent.Parent.Union.ParticleEmitter.Enabled = true script.Parent.Parent.Parent.smoke.Sound2.Looped = true script.Parent.Parent.Parent.smoke.Sound2:Play() wait(2) script.Parent.Value.Value = true end end script.Parent.ClickDetector.MouseClick:connect(onClicked)
To do this method, you're going to need Filtering Enabled
on. FE is a property of workspace.
Simply copy and paste your code into a local script, and move that script to StarterPack
.
Now you're going to have to re-define the Click Detector, but this isn't hard.
-- Local Script in StarterPack function onClicked() if script.Parent.Value.Value == true then script.Parent.Value.Value = false script.Parent.BrickColor = BrickColor.new("Bright red") script.Parent.Parent.Parent.lightning.ParticleEmitter.Enabled = false script.Parent.Parent.Parent.lightning2.ParticleEmitter.Enabled = false script.Parent.Parent.Union.ParticleEmitter.Enabled = true script.Parent.Parent.Parent.smoke.Sound2.Looped = true script.Parent.Parent.Parent.smoke.Sound2:Play() wait(2) script.Parent.Value.Value = true end end workspace.Part.ClickDetector.MouseClick:connect(onClicked)-- Get Click Detector
This is just one of the ways you can make Local Parts. It's best to always use Filtering Enabled, but it can me hard to learn at first.
Good Luck!
There are two ways to do this, I will be using the one that does not require FilteringEnabled (FE.) Mainly because it doesn't require you to change all of your other scripts to work with it.
Useful Resources:
http://wiki.roblox.com/index.php?title=API:Class/Workspace/CurrentCamera http://wiki.roblox.com/index.php?title=API:Class/LocalScript
Alright, what you'd need to do is have a LocalScript
somewhere within the player or character (this includes PlayerGui
/StarterGui
, Backpack
, Humanoid
, etc.)
In that LocalScript, you will be inserting a part into the local player's CurrentCamera
, like so:
Local Part Insertion
LocalScript
in StarterGui
local localCamera = game.Workspace.CurrentCamera Insert.new("Part", localCamera)
Anything in the local player's CurrentCamera
can only be seen by that player.
The downside with using this technique, though, is that scripts cannot run inside CurrentCamera
, so I do not suggest using this technique if you have scripts in those parts or anything like that. A solution to this is to have the scripts outside of CurrentCamera
, yet the parts inside, and edit that parts that way.
I also suggest that you learn to use FilteringEnabled
:
http://wiki.roblox.com/index.php?title=Client-Server_Model_and_FilteringEnabled
If you found my solution helpful, consider leaving an upvote and accepting my answer. Also, check out my website: http://robloxguides.com/!