End) presenting error

Hello! So this script was working not so long ago, and I must have messed something up, because now there is a red underline under the last
end)

local debounce = false

script.Parent.Touched:Connect(function(touch)
	if touch.Parent:FindFirstChild("Humanoid") and debounce == false then
		debounce = true
		local person = touch.Parent
		local player = game.Players:GetPlayerFromCharacter(person)
		if player.Character.SolidMaterial.Disabled == true then
			print("On ground")
			player.Character.SolidMaterial.Disabled = false
			player.Character.IceSkating.Disabled = true
	else 
		if player.Character.IceSkating.Disabled == true then
			print("On ice")
			player.Character.IceSkating.Disabled = false
			player.Character.SolidMaterial.Disabled = true
		end
		wait(2)
		debounce = false
	end
end)

Let me know if Iā€™m missing something

You missed an end

local debounce = false

script.Parent.Touched:Connect(function(touch)
	if touch.Parent:FindFirstChild("Humanoid") and debounce == false then
		debounce = true
		local person = touch.Parent
		local player = game.Players:GetPlayerFromCharacter(person)
		if player.Character.SolidMaterial.Disabled == true then
			print("On ground")
			player.Character.SolidMaterial.Disabled = false
			player.Character.IceSkating.Disabled = true
        end --This was the one you missed
	else 
		if player.Character.IceSkating.Disabled == true then
			print("On ice")
			player.Character.IceSkating.Disabled = false
			player.Character.SolidMaterial.Disabled = true
		end
		wait(2)
		debounce = false
	end
end)
1 Like