Help on part showing up on everyones screen instead of one client

  1. I want to make it so that when one player touches a part it vanishes on there screen and not the server

  2. I’ve tried putting a local script inside of the startergui and starterpack doing a touched event

here is the localscript that gets the touched event that I put inside of startergui


Halo1.Touched:Connect(function()
	Halo1.Transparency = 1
	wait(25)
	Halo1.Transparency = 0
end)

Any answers would be appreciated

1 Like
local LocalPlayer = game:GetService("Players").LocalPlayer
local Checkpoint1 = game.Workspace:WaitForChild("Checkpoint1")

Checkpoint1.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") and debounce == false then
		debounce = true
		local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
		if plr and plr == LocalPlayer then
			print(plr.Name)
            Checkpoint1:Destroy()
		end
	end
end)
1 Like

sorry wrong code I posted the new updated in the post! sorry about that

local Players = Game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
Halo1.Touched:Connect(function(hit)
	if hit.Parent:IsA("Model") and Players:GetPlayerFromCharacter(hit.Parent) and Players:GetPlayerFromCharacter(hit.Parent) == LocalPlayer then
		Halo1.Transparency = 1
		wait(25)
		Halo1.Transparency = 0
	end
end)
1 Like

Hey the script is nice but isn’t it easier to just check if

game.Players.LocalPlayer.Character == hit.Parent
2 Likes

No, because the character doesn’t always exist. Unlike the player.

I don’t get what you mean by that.
We would be checking if the player’s character touched that part. Which means the character exists ofc.

I would love to get your perspective on this.

Yes, that method would definetly work, hit.Parent would be the Player’s character so I don’t see a reason why that wouldn’t work.

If you used the character, you would also need to check if the character exists, otherwise you will run into errors. However, if you check if the player matches, you don’t need to check if the player is exists because player exists throughout the existence of the Local Script.