Hello, good day. I’ve been working on a button for a few weeks now or months (I don’t really know anymore). And, i’m stuck with debouncing. I don’t know what to do because i’m no scripter. The original code is from Push The Button and i made added little changes with it. I will really appreciate your help.
-- Services
local TweenService = game:GetService("TweenService")
-- Variables
local Obstacle = game.Workspace.Game.Obstacles.ObstaclePartA
local ObstacleTweenInfo = TweenInfo.new(
30,
Enum.EasingStyle.Quint,
Enum.EasingDirection.Out,
0,
false,
0
)
local Functions = {}
local touched = false
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if touched == false then
touched = true
-- Execute
function Functions:Execute()
print("Button with the ID" .. script.Parent.Name .."was pressed")
local ObstacleTween = TweenService:Create(Obstacle, ObstacleTweenInfo, {Transparency = 0, Position = Vector3.new(-86.45, -4.5, 75)})
ObstacleTween:Play()
wait(10)
touched = false
end
end
end
-- Return
return Functions
And this is the error i get:
“Expected ‘end’ (to close ‘function’ at line 18), got < eof >; did you forget to close ‘then’ at line 20?”