UI Effect Plays On All Clients

Hey there.

So I made a little checkpoint effect that plays everytime player reaches the checkpoint.

This is how it looks like : https://gyazo.com/6e0b34c663f7d9a551601572ce232653

And I have a lot of issues, I don’t really know why.

  1. The effect applies to every player - https://gyazo.com/a00c51345b23bab6aa2eaa023edad1a7

  2. When someone claimed the checkpoint already and the effect was played, the other player won’t see the effect anymore but will still claim the checkpoint. - https://gyazo.com/0db729970d04cde0c4f6f6e6163c7d47

How it works:
In workspace, i have two trigger parts which triggers the effect and then destroys the trigger part.

The GUI: abcdevc3245

And the code:

local stupidtext = script.Parent.TextLabel
local yes = script.Parent.CheckpointSound
local Player = game.Players.LocalPlayer
local vign = script.Parent.Overlay


function EffectEnd()
	for p = 0, 1, 0.05 do
		wait()
		vign.ImageTransparency = p
	end
	vign.ImageTransparency = 1
end

function EffectStart()
    vign.ImageTransparency = 0
end


function Close()
		for p = 0, 1, 0.05 do
			wait()
			stupidtext.TextTransparency = p
		end
	stupidtext.TextTransparency = 1
	end

function Open()
	stupidtext.Visible = true
	stupidtext.TextTransparency = 0
end

game.Workspace.Trigger1.Touched:Connect(function(OnTouch)
	local Humanoid = OnTouch.Parent:FindFirstChild("Humanoid")

	if Humanoid then
		local plr = game.Players:GetPlayerFromCharacter(OnTouch.Parent)

		if plr and plr == Player then
		end
		game.Workspace.Trigger1:Destroy()
		Open()
		yes:Play()
		stupidtext.Text = "ok that was easy"
		EffectStart()
		EffectEnd()
		wait(3)
		Close()
		end
end)

game.Workspace.Trigger2.Touched:Connect(function(OnTouch)
	local Humanoid = OnTouch.Parent:FindFirstChild("Humanoid")

	if Humanoid then
		local plr = game.Players:GetPlayerFromCharacter(OnTouch.Parent)

		if plr and plr == Player then
		end
		game.Workspace.Trigger2:Destroy()
		Open()
		yes:Play()
		stupidtext.Text = "good good lets keep going"
		EffectStart()
		EffectEnd()
		wait(3)
		Close()
	end
end)

Hopefully someone will fix this for me, I’ll be very thankful!!!
(im not good at scripting please dont sue me :((((((((((((( )

2 Likes

When the trigger is triggered, check to make sure that the player triggering it is the local player:

game.Workspace.Trigger1.Touched:Connect(function(hit)
    local player = game.Players:GetPlayerFromCharacter(hit.Parent)

    if player then
        if player == game.Players.LocalPlayer then
            -- your code
        end
    end
end)

You can try it for every trigger. I hope this helps :slight_smile:

Thank you so much!!!

1 Like