Hello I want to make a brick only one player can see it and also I want to make a brick that I you get closer, it gets more transparent. Any way to make this work?
Thanks
Kristian993876674778
Hello I want to make a brick only one player can see it and also I want to make a brick that I you get closer, it gets more transparent. Any way to make this work?
Thanks
Kristian993876674778
Take note that scripting support is not the place to ask for code nor expect it to come for free. You must attempt it yourself and come back when you run into issues.
To give you a place to start looking, check out these developer hub pages:
Edit:
Since this is relatively simple, I guess I could show you how to accomplish it
|Local Script|
local Players = game:GetService("Players") --this is different from "Player" which I linked
local Player = Players.LocalPlayer --this is the player that I linked
local Part = workspace.Part --or create it locally
local Offset = 10 --so the player doesn't have to be so close to the part just to make it transparent
while true do
local Distance = Player:DistanceFromCharacter(Part.Position) --we get the distance of the player's character from the part
if Distance then --we check if distance can be obtained because this can cause errors sometimes (mentioned in the developer hub page)
Part.Transparency = (-1 + (Distance - Offset) / 10)*-1 --set the transparency of the part relative to the character's distance
-- i can't really explain the math, but it works :P
end
wait()
end
Oh ok I’m new in this forum sorry
I updated my reply because I realized the code did the complete opposite.
thanks i’m gonna try it out. Can’t wait
So where to put the script in because i put it in a part
This only works in a local script. Local scripts only run when they are placed in:
I don’t remember the rest, but this is pretty much most if not all of it.
Ideally, you would place this script in StarterPlayerScripts
thanks now it works. its amazing