So I am trying to make a teleportation orb that will teleport you to it in 2 seconds. Now I am trying to add wall hit detection to make sure the player cannot clip threw a wall.
-- Shortcuts to simplify and quicken the process of understanding
local uis = game:GetService("UserInputService")
local currentcamera = game.Workspace.CurrentCamera
local cooldown = true
local Player = game.Players.LocalPlayer.Name
local test = Player.Character or script.Parent
-- normal walk speed without sprint
-- actual code to sprint
-- attempt at dash
uis.InputBegan:connect(function(input,gameproccesed)
if input.KeyCode==Enum.KeyCode.Q then
if cooldown == true then
cooldown = false
local offset = Vector3.new(0,0,-20)
local wehitawall = false
local tp = Instance.new("Part")
tp.CanCollide = false
tp.Parent = game.Workspace
tp.BrickColor = BrickColor.new("New Yeller")
tp.Material = ("Neon")
tp.Anchored = false
tp.Transparency = 0.5
tp.Size = Vector3.new(3,3,3)
tp.CFrame = test.HumanoidRootPart.CFrame * CFrame.new(0,0,-12)
local tpv = Instance.new("BodyVelocity", tp)
tpv.Velocity = test.HumanoidRootPart.CFrame.LookVector * 50
tpv.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
tpv.Parent = tp
local effect = Instance.new("Sparkles")
effect.SparkleColor = Color3.new(255, 0, 0)
tp.Touched:Connect(function(hit) --problem here
if not hit.Parent:FindFirstChild("Humanoid")
then
local wehitawall = true
end
if wehitawall == false
then
wait(2)
else
wait(0)
end
effect:Destroy()
game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = tp.CFrame
local boom = Instance.new("Explosion")
boom.Parent = tp
boom.Position = tp.Position
boom.BlastRadius = 0
tp.Transparency = 1
wait(1)
tp:Destroy()
boom:Destroy()
cooldown = true
end
end) -- other half of problem
end)
-- Animation test
local Humanoid = test:FindFirstChild("Humanoid")
local UserInputService = game:GetService("UserInputService")
local AnimationID = 'rbxassetid://4885286691'
local Debounce = true
local key = 'Q'
UserInputService.InputBegan:Connect(function(Input, IsTyping)
if IsTyping then return end
if Input.KeyCode == Enum.KeyCode[key]and Debounce == true then
Debounce = false
local Animation = Instance.new("Animation")
Animation.AnimationId = AnimationID
local LoadAnimation = Humanoid:LoadAnimation(Animation)
LoadAnimation:Play()
wait(3)
Animation:Destroy()
Debounce = true
end
end)
I have put an ´end)´to line 58 but it says the same thing. If I place only an ) it says:
test:59: Expected identifier when parsing expression, got ')'
I is confusion. Please help :)

5 comments
it could be that you have too little or to many ends make sure that every piece of code has an end attached to it. Also make sure just to edit questions instead of asking another.
try on line 58 to put end instead of end)
@6zk8 is correct, line 58 is for an if then statement, it doesn't need the ). So, line 58 should be end instead of end).
I tried adding just end it gave me same error. And I TRIED checking and counting for missing ends but I couldnt seem to find any.
You still need a bracket on the last end (line 59), the other one (line 58) does not need it since "if input.KeyCode==Enum.KeyCode.Q then" (line 13) has no open ended brackets. This is also happening on line 37, though this time it is an open ended bracket on line 33 that's missing a closing bracket on the end. Also if you click near a bracket in the script it will highlight its accompanying bra