basically what i wanna do is that when you touch a part, another part gets set to transparent but everyone sees that part as transparent instead of just that player, that's the problem.
✓ ANSWER ACCEPTED
How to make a script make a function appear only to the player who touched it?
2 answers
✓ Accepted answer
This is simple and easy to do.
First create a local script, you can put this script inside anywhere that can work(I'll put it inside StarterPlayerScripts).
Inside the local script type:
local part -- location of your part in your game.
local transparent_part -- location of your part you want transparent
local Players = game:GetService('Players)
local plr = Players.LocalPlayer -- our client(player)
local transparency = 1 -- the number of transparency you want the part to get
part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild('Humanoid') then -- verifies if hit's parent has 'Humanoid' as a children.
if Players:GetPlayerFromCharacter(hit.Parent) == plr then -- verifies if the player that touched the part is our client.
transparent_part.Transparency = transparency -- sets transparency to part
end
end
end)
local Players = game:GetService("Players")
local Part1 = workspace.Part1
local Part2 = workspace.Part2
Part1.Touched:Connect(function(Hit)
local Player = Players:GetPlayerFromCharacter(Hit.Parent)
if Player then
if Player ~= Players.LocalPlayer then
-- Someone touched the brick, but not me!
Part2.Transparency = 1
end
end
end)
It's pretty self explanatory, also this is still a LocalScript, I'm just kind of confused on your question
3 comments
0
sorry this was not what i meant. i meant that IF the player touched the part, another part gets set to transparent but that part appears transparent to everybody else, and not the player. that's what i'm trying to do.
0
Alright
0
where do i put the localscript? if i put it in a brick it usually doesn't work
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
i edited my answer