Hello! I made a script that, when you touch a part, shows you an image
The thing is, my script just affects everyone, like for ex.: If one touches the part, all players will see the GUI too, including the player that touched it.
Can someone help me so that it only affects one person?
Script (It’s in a LocalScript)
local ts = game:GetService("TweenService")
local inf = TweenInfo.new(0.5,Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false, 0)
local function Tween(Object,Value)
local OutTween = ts:Create(Object,inf,{ImageTransparency = Value})
OutTween:Play()
end
local part = game.Workspace.improvedtext
local canhit = true
local chapter = script.Parent.chapter
local info = script.Parent.info
chapter.AnchorPoint = Vector2.new(0, 0)
chapter.Position = UDim2.new(0.277, 0, 0.236, 0)
info.AnchorPoint = Vector2.new(0, 0)
info.Position = UDim2.new(0.356, 0, 0.362, 00)
part.Touched:Connect(function(hit)
if hit and hit.Parent:FindFirstChild("Humanoid") then
if canhit == true then
canhit = false
Tween(script.Parent.chapter,0)
chapter:TweenPosition(UDim2.new(0.277, 0,0.166, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Sine)
wait(0.25)
Tween(script.Parent.info,0)
info:TweenPosition(UDim2.new(0.356, 0,0.296, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Sine)
wait(4)
Tween(script.Parent.chapter,1)
chapter:TweenPosition(UDim2.new(0.277, 0, 0.236, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine)
Tween(script.Parent.info,1)
info:TweenPosition(UDim2.new(0.356, 0, 0.362, 00), Enum.EasingDirection.Out, Enum.EasingStyle.Sine)
canhit = true
end
end
end)