Is it possible to make it so that when the gui tweens on the players screen that it happens locally or only for the player that touched the part

so what i want to happen is that when the player touches the part then the text label inside of the screengui tweens on the players screen for only the player that touches the part and not for everyone in the server. So would I need to make a local script?, im not sure how to do this, can anyone help me

Here is the part in workspace called Touch part:

the textbutton is placed inside of a screengui in Startergui and here is the script located inside of the text label:

1 Like

Change it to a LocalScript and it should work just fine! :thinking:

You should be making it a LocalScript in the first place… anyways I think your problem is you check when it’s touched, but you’re not checking if it’s touched by the LocalPlayer. Add a check to see if the person who touches this should part is the LocalPlayer

how would I go about this? would i say

script.Parent.LocalPlayer.Touched:Connect(function) and so on or no?

in new to scripting so im still getting famiiar with things like scripting

LocalPlayer won’t be in the gui, so that’s won’t work. Also the Player Instances is not a BasePart, .Touched only fires for BaseParts. What you could try doing is defining the character in a LocalScript, then checking if the Part that touched it is Part of that character

could you maybe give me a example

im not sure how this works

local GuiThing = PathToGui
local Player = game.Players.LocalPlayer

workspace.Part.Touched:Connect(function(hit)
      local Character = Player.Character
               if hit:IsDescendantOf(Character) then
               --Tween 
             end
           end)

this did not work and now i cant even get my textbutton to tween up in the screen anymore

can anyone else help me? the text label still tweens for both players even though i want it to only tween for the player that touched the part and not for every player on the server

See the tutorial linked in this post for this issue:

It’s pseudo code. You’re not meant to paste it directly…

i did not place it directly, the script just didnt work

honestly at this point i dont even know anymore. The gui doesnt tween at all anymore and this is what I changed my script to:

local LocalPlayer = game:GetService(“Players”).LocalPlayer

game.Workspace.TouchPart.Touched:Connect(function(hit)

if LocalPlayer.Character and hit:IsDescendantOf(LocalPlayer.Character) then

script.Parent:TweenPosition(UDim2.new(0.312,0,0.6,0), “InOut”, “Quart”,4,false)

wait(0.5)

script.Parent:TweenPosition(UDim2.new(0,170,1,0), “InOut”, “Quart”,4,false)

end

end)

Fire a remotevent to the client and do it on a local script

im new to scripting so I wouldnt be sure to know how to do that