Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make part visible to only specific player?

Asked by 4 years ago

I put this in a local script, and used this script but doesn't work properly, any suggestions?

function onTouched(Hit)
    script.Parent.Parent.Door.Transparency= 0
    script.Parent.Parent.Door.CanCollide= true
end
script.Parent.Touched:connect(onTouched)

2 answers

Log in to vote
0
Answered by
BryanFehr 133
4 years ago

https://www.youtube.com/watch?v=5J6xWj4Oxdk

It's the way I've done it, so give it a whirl. If it doesn't work, I can further help via discord; BryanFehr#3070

Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Ok, this is kind of simple. You have to make the part transparent and can collide is off. Then in a LocalScript, not a server script. Then if you want a specific player to see something, then just do whatever you need in the local script.

Edit: I see the problem. You didn't check what the part touched. It could have touched another part and set it off. Make sure you know a player touched it.

script.Parent.Touched:Connect(function(hit)
    local char = hit.Parent
    local humanoid = char:FindFirstChild("Humanoid")
    if humanoid~=nil then
        --whatever code you need to do
    end
end)

Answer this question