#Roblox Studio Lua Part Invisible for only one Player
10 messages · Page 1 of 1 (latest)
Thanks for your question :clap:, if someone gives you an answer it would be great if you thanked them with a :white_check_mark: in response. This response will earn you both points for special roles on this server.
@solid nimbus zichtig's Question:
I have a Variable in the Leaderboard and i want if the Variable is 100 that a part is invisible and collision is false BUT only for the one player only for the one that have 100 of that variable how do i do that?
To implement such functionality, you can use the platform's scripting or game engine features (like Unity, Unreal Engine, etc.) to check the player's score and modify the visibility and collision properties of a game object specifically for that player. Here's a generic pseudocode example that can be adapted to your needs:
if (player.score == 100) {
gameObject.setVisible(false);
gameObject.setCollisionEnabled(false);
}
This pseudocode checks if the player's score is 100, and if so, it makes the specified game object invisible and disables its collision. Keep in mind, this only affects the local player's view and interactions if the code is run on the client side.
In a multiplayer environment, you'll need to ensure that these changes are only applied to the relevant player's instance and not globally. Here's a conceptual example using Unity's C# scripting for a networked game:
if (player.score == 100) {
// Assuming 'player' is the local player and 'gameObject' is what you want to hide
if (player.isLocalPlayer) {
gameObject.GetComponent<Renderer>().enabled = false;
gameObject.GetComponent<Collider>().enabled = false;
}
}
For an elaborate implementation, you would include network synchronization (e.g., using Mirror, Photon, etc.) to ensure that the state changes are accurately reflected and handled across the network.
Simply do local script
if you know how to code you should be able to just put it in starter player scripts
as a local script
right?
so you have the leaderboard and you take the value as a variable
if variable == 100 then
part.Transparency = 1
part.CanCollide = false
end
thanks