#Help with .Touched

1 messages · Page 1 of 1 (latest)

visual stone
#

Can Somebody please help me use TouchEnded Correctly?

local TweenService = game:GetService("TweenService")
local shopgui = script.Parent
local stroke = script.Parent.UIStroke

local part = workspace:WaitForChild("BuyCl")

local tweenInInfo = TweenInfo.new(0.2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
local tweenOutInfo = TweenInfo.new(0.2, Enum.EasingStyle.Linear, Enum.EasingDirection.In)

local tweenin = TweenService:Create(shopgui, tweenInInfo, {Transparency = 0})
local tweenout = TweenService:Create(shopgui, tweenOutInfo, {Transparency = 1})

part.Touched:Connect(function()
shopgui.Visible = true
stroke.Enabled = true
tweenin:Play()
end)

part.TouchEnded:Connect(function()
    task.wait(1)
    tweenout:Play()
    stroke.Enabled = false
    task.wait(0.3)
    shopgui.Visible = false
end)
rain pelican
#

you can try to check for a specific bodypart of the player. part.Touched fires every time anything touches it. It can be other players or other parts from the same player.
You can add a variable like Hit in the brackets of the function and then do

if Hit == AnyBodypart then
  -- code here
end
visual stone
#

ah yea youre right i already fixed it myself