How to tween Gui when Brick Touched

So basically I want to make A gui tween to the player when he touches a Part but when I do it, it shows on all players heres the code

local Frame = Player.PlayerGui.Shop.Frame


game.Workspace.ShopTouch.Touched:Connect(function(plr)

		Frame:TweenPosition(UDim2.new(0.251, 0,0.236, 0), 'Out', 'Bounce', '1')
end)

all in a local script

Where is the script exactly located? It should be somewhere in StarterGui I presume? Also uhhh

YoU doN’t nEeD tHaT eXtRa pAraMetEr

Yep its in StarterGui :sweat_smile:

I’m guessing this is a local script? The issue is you’re not doing any “Filtering”, since if it’s touched, there’s nothign to check if it was touched by a certain player, hence why it does it on everyone

game.Workspace.ShopTouch.Touched:Connect(function(plr)
	if Player.Character and plr:IsDescendantOf(Player.Character) then
		Frame:TweenPosition(UDim2.new(0.251, 0,0.236, 0), 'Out', 'Bounce', '1')
	end
end)

Where Player is your localplayer

Hey remember that guy with the pink egg and the gui showed up for all players even in a local script? This might be a bug (infinityTNT)

2 Likes

Reference? I forgot where the topic was

Oh that, yeah I think I might’ve indexed the Check variable the wrong way

Guess I’d need to think about doing it server sided then without a LocalPlayer

Put a remote event in Replicated, then name it “ShowGui”
server script in part:

local DB = false
local Event = game:GetService('ReplicatedStorage'):WaitForChild('ShowGui')
script.Parent.Touched:Connect(function(Plr)
      if not DB then
           DB = true           
           Event:FireClient(plr)
           wait(5)
           DB = false
     end
end

Client script in startergui:

local Event = game:GetService('ReplicatedStorage'):WaitForChild('ShowGui')
Event.OnClientEvent:Connect(function()
       game:GetService('Players').LocalPlayer.ScreenGui.Shop.Frame:TweenPosition((UDim2.new(0.251, 0,0.236, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Bounce, 1))
end)

No need, the issue has already been resolved, they just needed to filter out the touched input