getting error Players.8Cert.PlayerScripts.RemoteLocalScript:30: Expected ‘end’ (to close ‘function’ at line 26), got ‘if’
wait(2)
local Players = game:GetService("Players")
local seat = game.workspace.ScriptedArtillery.ArtillerySeat
local player = Players.LocalPlayer
local IsSitting = false
local trajectorybeam = game.Workspace.ScriptedArtillery.End.TrajectoryMarker
local function onOccupantChanged()
local humanoid = seat.Occupant
IsSitting = (humanoid == player.Character.Humanoid)
end
local UserInputService = game:GetService("UserInputService")
local remoteEvent = game.ReplicatedStorage.ShootSmoke
local TimeSinceFPress = 0
local Cooldown = 5
function canUse()
local CanUseRightNow = false
local CurrentTime = tick()
return CurrentTime - TimeSinceFPress >= Cooldown
if CurrentTime - TimeSinceFPress >= Cooldown then
CanUseRightNow = true
else
CanUseRightNow = false
return CanUseRightNow
end
end
seat:GetPropertyChangedSignal("Occupant"):Connect(onOccupantChanged)
UserInputService.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.F and IsSitting and CanUseRightNow then
remoteEvent:FireServer()
print("hi")
end
end)
trajectorybeam.Enabled = false
while wait() do
if IsSitting then
trajectorybeam.Enabled = true
else
trajectorybeam.Enabled = false
end
end```
x